Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Storing data in binary files

807599Dec 15 2006 — edited Dec 15 2006
I am trying to store my data in binary files to save space and lessen time spent on hard disk reads. However, I can't seem to find the proper way to do this in java.

For example, I have the integer 65535 in java. How do I convert it into a 2 byte string FF FF in java?

When I read 2 bytes FF FF to a string from a binary file, how do I interpret it as a -32767 or a 65535 ?

Sorry if this seems like a really obvious question. None of the integer or string methods in java seems to do what I want :(
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2007
Added on Dec 15 2006
3 comments
278 views