public static int toInt(ByteBuffer buf,int offset){
  if (littleEndian) {
    return Integer.reverseBytes(getAsInt(buf,offset));
  }
  return getAsInt(buf,offset);
}

public static int toInt ( ByteBuffer buf , int offset ) { if ( littleEndian ) { return Integer . reverseBytes ( getAsInt ( buf , offset ) ) ; } return getAsInt ( buf , offset ) ; }
reads an int value at the given buffer ' s offset considering it was written in big - endian format .
