I need to write a very large amount of Numbers to a File in a very memory efficient way with java.
The Numbers are in range from 0 to 2,132,487 so that a Short data type(16bit) would not be enough but a Integer(32bit) would be a waste of space.
The most efficient way would be to use 22Bits for each Number (2²²= 4,194,394)
How could i implement that?