jvm - How to compress variables in Java using leading zero byte suppression? -


leading 0 byte suppression means leading 0 bytes of integer value removed , instead number of eliminated bytes stored. example: suppose have 32-bit integers, hexadecimal value 00000090 encoded binary value 01110010000, 011 means there 3 0 bytes in 00000090.

my question how implement leading 0 byte suppression in java? give me examples?

in example, suggest 0x00000090 encoded 11-bit number 0b01110010000. know, there no 11-bit data types in java, doing "the java way" impossible.

the way can think of achieve you're trying use single byte array store of data, implement 0 byte suppression algorithms on top of that. of course, remove entire point of java, object-oriented.

if you're trying implement sort of integerzerobytesuppression class, effort naught, because every object in java comes several bytes of overhead anyway, far outweighing few bits you'll save 0 byte suppression itself.

in end, if really need few bits of memory you'll save (doubtful, don't know you're working on), suggest either finding language little no overhead in object-oriented capabilities (e.g. c++) or language implements 0 byte suppression default (?).


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -