public static void writeInt ( int num , ByteBuffer buf ) { if ( num == 0 ) { buf . put ( ( byte ) 0 ) ; return ; } final byte bytes_needed = bytesRequiredFor ( num ) ; buf . put ( bytes_needed ) ; for ( int i = 0 ; i < bytes_needed ; i ++ ) buf . put ( getByteAt ( num , i ) ) ; }
Writes an int to a ByteBuffer