public static void put3ByteInt(ByteBuffer buffer,int val,int offset,ByteOrder order){
  int offInc=1;
  if (order == ByteOrder.BIG_ENDIAN) {
    offInc=-1;
    offset+=2;
  }
  buffer.put(offset,(byte)(val & 0xFF));
  buffer.put(offset + (1 * offInc),(byte)((val >>> 8) & 0xFF));
  buffer.put(offset + (2 * offInc),(byte)((val >>> 16) & 0xFF));
}

public static void put3ByteInt ( ByteBuffer buffer , int val , int offset , ByteOrder order ) { int offInc = 1 ; if ( order == ByteOrder . BIG_ENDIAN ) { offInc = - 1 ; offset += 2 ; } buffer . put ( offset , ( byte ) ( val & 0xFF ) ) ; buffer . put ( offset + ( 1 * offInc ) , ( byte ) ( ( val > > > 8 ) & 0xFF ) ) ; buffer . put ( offset + ( 2 * offInc ) , ( byte ) ( ( val > > > 16 ) & 0xFF ) ) ; }
put an integer into the given buffer at the given offset as a 3 - byte integer .
