java - Why size of 'BigInteger' differs when saved from what 'bitLength' reports? -
i have variable named out biginteger. when trying length of variable in bits using
out.bitlength(); i receive 46.
if save in file using
objectoutputstream oos = new objectoutputstream(new fileoutputstream("./testbig.dat")); oos.writeobject(out); oos.close(); i file 208 bytes.
can explain me why 2 values differ?
this because objectoutputstream stores objects in java's serialization format; not store raw content of biginteger object.
you can read content deserializing it, example objectinputstream.
Comments
Post a Comment