I\'m trying to write data to a file in binary format for compression. The data consists entirely of floating points so I decided to quantize the data to an intergers between
What about the DataOutputStream. You can write int which contains 2 of your data integers.
DataOutputStream dos = new DataOutputStream(new FileOutputStream(<path>));
ArrayList<Integer> list = new ArrayList<Integer>();
int sum;
for( int i = 0; i < list.size(); i++ ) {
if(i%2!=0){
sum |= list.get( i ).intValue()<<16;
dos.writeInt( sum );
} else {
sum = list.get( i ).intValue();
}
}
Maybe this fragment will help.
int i = 42;
DataOutputStream os = new DataOutputStream(new FileOutputStream("C:\\binout.dat"));
os.writeInt(i);
os.close();