public static int putShort ( byte [ ] bytes , int offset , short val ) { if ( bytes . length - offset < SIZEOF_SHORT ) { throw new IllegalArgumentException ( "Not enough room to put a short at" + " offset " + offset + " in a " + bytes . length + " byte array" ) ; } bytes [ offset + 1 ] = ( byte ) val ; val >>= 8 ; bytes [ offset ] = ( byte ) val ; return offset + SIZEOF_SHORT ; }
Put a short value out to the specified byte array position .