private static int intFromSubArray(final byte[] bytes, final int from, final int to) {
    final byte[] subBytes = Arrays.copyOfRange(bytes, from, to);
    final ByteBuffer wrap = ByteBuffer.wrap(subBytes);
    return wrap.getInt();
  }
private static int intFromSubArray ( final byte [ ] bytes , final int from , final int to ) { final byte [ ] subBytes = Arrays . copyOfRange ( bytes , from , to ) ; final ByteBuffer wrap = ByteBuffer . wrap ( subBytes ) ; return wrap . getInt ( ) ; }
Take a slice of an array of bytes and interpret it as an int.
@param bytes Array of bytes
@param from  Start index in the array
@param to    End index in the array
@return int