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

Method main

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

Source from the content-addressed store, hash-verified

8
9public class Endians {
10 public static void main(String[] args) {
11 ByteBuffer bb = ByteBuffer.wrap(new byte[12]);
12 bb.asCharBuffer().put("abcdef");
13 System.out.println(Arrays.toString(bb.array()));
14 bb.rewind();
15 bb.order(ByteOrder.BIG_ENDIAN);
16 bb.asCharBuffer().put("abcdef");
17 System.out.println(Arrays.toString(bb.array()));
18 bb.rewind();
19 bb.order(ByteOrder.LITTLE_ENDIAN);
20 bb.asCharBuffer().put("abcdef");
21 System.out.println(Arrays.toString(bb.array()));
22 }
23}
24/* Output:
25[0, 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102]

Callers

nothing calls this directly

Calls 4

orderMethod · 0.80
putMethod · 0.45
toStringMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected