So, I took a few minutes to actually run the code, and it took a little change from your published code, but here it is.
The only thing I did, it was - optionally - was changing intBuffer to longBuffer , just for clarity. This is part of the first difference.
75 - byte[] inflated = new byte[Math.min(1<<17, a.length*4)]; 76 - ByteBuffer intBuffer = ByteBuffer.wrap(inflated); 76 + byte[] inflated = new byte[Math.min(1<<17, a.length*8)]; 77 + ByteBuffer longBuffer = ByteBuffer.wrap(inflated);
In the above snippet, I change the length of the inflated buffer to a.length * 8 to reflect it as a long array, not an int array.
89 - int n = inflater.inflate(inflated,intBuffer.position(), intBuffer.remaining()); 90 + int n = inflater.inflate(inflated,longBuffer.position(), longBuffer.remaining());
This is just a variable name change.
92 - intBuffer.position(intBuffer.position()+n).flip(); 93 - for (;intBuffer.remaining()>3 && i<a.length;i++){
This is a very important change. The name was changed at first, but this is not an important part. Secondly, remaining() is 7 instead of 3, as mentioned above. Finally, a [i] now gets the length instead of int. . This is the biggest problem, of course.
96 - intBuffer.compact(); 97 + longBuffer.compact();
Just a rename here.
142 - System.out.printf("File length: %d, for %d ints, ratio %.2f in %.2fms %n", file.length(), n.length, ((double)file.length())/4/n.length, java.math.BigDecimal.valueOf(elapsed, 6) ); 143 + System.out.printf("File length: %d, for %d ints, ratio %.2f in %.2fms %n", file.length(), n.length, ((double)file.length())/8/n.length, java.math.BigDecimal.valueOf(elapsed, 6) );
This is only the output of the file, to get an idea of โโcompression, now it calculates the number of results from the .length / 8 file instead of more than 4.
And these are the only necessary changes that I had to make to make it work. Basically just moving from int to long in all places.
The full code is here in pastebina, in case you mess up the diff designation or something else: http://pastebin.com/emY14Ji4
Note: the line numbers in my copy (+) are higher than your copy (-) due to a debugging instruction that I did not delete ... whoops ...