I am trying find an alternative for a byteBuffer.putShort method. I want same functionality of putshort. So we have any? My jdk (1.4.2) does not support Byte buffer.
putShort() does nothing special. The ByteBuffer has information on whether its BigEndian or LittleEndian, - unsure whether your problem needs to consider this. If you do, you need to flip the bytes. Otherwise, it just stores to a backing byte array, and splits the short value into bytes like: byte1 = (byte)(myShort >> 8); byte2 = (byte)(myShort >> 0);
putShort()does nothing special. The ByteBuffer has information on whether its BigEndian or LittleEndian, - unsure whether your problem needs to consider this. If you do, you need to flip the bytes. Otherwise, it just stores to a backing byte array, and splits the short value into bytes like:byte1 = (byte)(myShort >> 8); byte2 = (byte)(myShort >> 0);