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

Method symmetricScramble

newio/UsingBuffers.java:8–17  ·  view source on GitHub ↗
(CharBuffer buffer)

Source from the content-addressed store, hash-verified

6
7public class UsingBuffers {
8 private static
9 void symmetricScramble(CharBuffer buffer) {
10 while(buffer.hasRemaining()) {
11 buffer.mark();
12 char c1 = buffer.get();
13 char c2 = buffer.get();
14 buffer.reset();
15 buffer.put(c2).put(c1);
16 }
17 }
18 public static void main(String[] args) {
19 char[] data = "UsingBuffers".toCharArray();
20 ByteBuffer bb =

Callers 1

mainMethod · 0.95

Calls 2

getMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected