I have to write a biginteger into a text file using the following statement.
out.writeObject(n1);
where my n1 is a biginteger of length 512 bits.
On reading the same object from the text file gives me a different value to n1. Could anyone help me with the problem.
The statement used to read the value is :
in.readObject();
Thanks in advance.
You forgot to post SSCCE, so here is one for you:
Works like a charm, serializing and deserializing
3^100. Can you try the code above?UPDATE: example with file (sorry for non-descriptive variable names):
BTW storing Java-serialized binary data in a file with
.txtextension is generally a bad idea… And don’t forget about caching! (BufferedInputStream/BufferedOutputstream).