I’m having trouble getting a bit to work properly in java6…I’m trying to write a compression program that will write bits to a compressed file…so for example a common letter such as “e” might just be the binary sequence “101” in ascii
I think the fileOutputStream.write(int) method is what I’m going to want to accomplish this, but how to I represent a sequence of bits as in int?
You can use
BitSet. And then write a full byte array usingFileOutputStream#write(byte\[\])like that: