Java ShortBuffer.put(ShortBuffer src)

Syntax

ShortBuffer.put(ShortBuffer src) has the following syntax.

public ShortBuffer put(ShortBuffer src)

Example

In the following code shows how to use ShortBuffer.put(ShortBuffer src) method.


import java.nio.ShortBuffer;
import java.util.Arrays;
// w  w  w . ja  v  a2s . c om
public class Main {
  public static void main(String[] args) {
    ShortBuffer bb = ShortBuffer.allocate(10);
    bb.put((short)100);
    
    bb.rewind();
    
    
    ShortBuffer shortBuffer2 = ShortBuffer.allocate(10);
    
    shortBuffer2.put(bb);
    
    System.out.println(Arrays.toString(shortBuffer2.array()));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer