@Test public void testEncode99() throws Exception { byte[] b = new byte[1]; BcdPrefixer.LL.encodeLength(99, b); TestUtils.assertEquals(new byte[]{(byte)0x99}, b); }
@Override public void encodeLength(int length, byte[] b) { for (int i = getPackedLength() - 1; i >= 0; i--) { int twoDigits = length % 100; length /= 100; b[i] = (byte)((twoDigits / 10 << 4) + twoDigits % 10); } }
BcdPrefixer implements Prefixer { @Override public void encodeLength(int length, byte[] b) { for (int i = getPackedLength() - 1; i >= 0; i--) { int twoDigits = length % 100; length /= 100; b[i] = (byte)((twoDigits / 10 << 4) + twoDigits % 10); } } }
BcdPrefixer implements Prefixer { @Override public void encodeLength(int length, byte[] b) { for (int i = getPackedLength() - 1; i >= 0; i--) { int twoDigits = length % 100; length /= 100; b[i] = (byte)((twoDigits / 10 << 4) + twoDigits % 10); } } BcdPrefixer(int nDigits); }
BcdPrefixer implements Prefixer { @Override public void encodeLength(int length, byte[] b) { for (int i = getPackedLength() - 1; i >= 0; i--) { int twoDigits = length % 100; length /= 100; b[i] = (byte)((twoDigits / 10 << 4) + twoDigits % 10); } } BcdPrefixer(int nDigits); @Override void encodeLength(int length, byte[] b); @Override int decodeLength(byte[] b, int offset); @Override int getPackedLength(); }
BcdPrefixer implements Prefixer { @Override public void encodeLength(int length, byte[] b) { for (int i = getPackedLength() - 1; i >= 0; i--) { int twoDigits = length % 100; length /= 100; b[i] = (byte)((twoDigits / 10 << 4) + twoDigits % 10); } } BcdPrefixer(int nDigits); @Override void encodeLength(int length, byte[] b); @Override int decodeLength(byte[] b, int offset); @Override int getPackedLength(); static final BcdPrefixer L; static final BcdPrefixer LL; static final BcdPrefixer LLL; static final BcdPrefixer LLLL; static final BcdPrefixer LLLLL; }