MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

newio/IntBufferDemo.java:10–24  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8public class IntBufferDemo {
9 private static final int BSIZE = 1024;
10 public static void main(String[] args) {
11 ByteBuffer bb = ByteBuffer.allocate(BSIZE);
12 IntBuffer ib = bb.asIntBuffer();
13 // Store an array of int:
14 ib.put(new int[]{ 11, 42, 47, 99, 143, 811, 1016 });
15 // Absolute location read and write:
16 System.out.println(ib.get(3));
17 ib.put(3, 1811);
18 // Setting a new limit before rewinding the buffer.
19 ib.flip();
20 while(ib.hasRemaining()) {
21 int i = ib.get();
22 System.out.println(i);
23 }
24 }
25}
26/* Output:
2799

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected