JBBPFieldString extends JBBPAbstractField { public static String reverseBits(final String value) { String result = null; if (value != null) { final char[] chars = value.toCharArray(); for(int i=0; i<chars.length; i++) { chars [i] = (char)JBBPFieldUShort.reverseBits((short)chars[i]); } result = String.valueOf(chars); } return result; } JBBPFieldString(final JBBPNamedFieldInfo name, final String nullableValue); String getAsString(); static String reverseBits(final String value); @Override String getTypeAsString(); static final String TYPE_NAME; }
@Test public void testReverseBits_Null() { assertNull(JBBPFieldString.reverseBits(null)); }
@Test public void testReverseBits_Text() { assertEquals("\u0C00谀䰀", JBBPFieldString.reverseBits("012")); assertEquals("012", JBBPFieldString.reverseBits(JBBPFieldString.reverseBits("012"))); }