code: public static int putInt(byte[] bytes, int offset, int val) {
      if (bytes.length - offset < SIZEOF_INT) {
        throw new IllegalArgumentException("Not enough room to put an int at"
            + " offset " + offset + " in a " + bytes.length + " byte array");
      }
      for (int i = offset + 3; i > offset; i--) {
        bytes[i] = (byte) val;
        val >>>= 8;
      }
      bytes[offset] = (byte) val;
      return offset + SIZEOF_INT;
    }
docs: Put an int value out to the specified byte array position.
  @param bytes the byte array
  @param offset position in the array
  @param val int to write out
  @return incremented offset
  @throws IllegalArgumentException if the byte array given doesn't have
  enough room at the offset specified.