title: Compressing array of integers in java
body: <p>I have some extremely large array of integers which i would like to compress.<br>
  However the way to do it in java is to use something like this -</p>
  
  <pre><code>int[] myIntArray;
  ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(1024);
  ObjectOutputStream objectOutputStream = new ObjectOutputStream(new DeflaterOutputStream(byteArrayOutputStream));
  objectOutputStream.writeObject(myIntArray);
  </code></pre>
  
  <p>Note that the int array first needs to be converted to bytes by java.
  Now I know that is fast but it still needs to create a whole new byte array and scan through the entire original int array converting it to bytes and copying the value to the new byte array.  </p>
  
  <p>Is there any way to skip the byte conversion and make it compress the integers right away?</p>