CharBuffer { int nextAsDigit() { return toDigit(next()); } private  CharBuffer(char[] cs); @Override String toString(); public char[] cs; public int position; }
@Test public void nextAsDigit() { CharBuffer buffer = CharBuffer.fromString("c1"); assertFalse(buffer.nextIsDigit()); assertThat(buffer.get(), is('c')); assertTrue(buffer.nextIsDigit()); assertThat(buffer.nextAsDigit(), is(1)); assertTrue(buffer.nextIsDigit()); assertThat(buffer.getAsDigit(), is(1)); assertFalse(buffer.nextIsDigit()); }