@Test public void testComposeRFBytes() throws Exception { byte[] testSingle = new byte[]{(byte) 0xa7}; byte[] testSingleOutput = new byte[]{(byte) 0xa9, 0x60}; assertArrayEquals(testSingleOutput, RileyLinkUtil.composeRFStream(testSingle)); byte[] testDouble = new byte[]{(byte) 0xa7, 0x12}; byte[] testDoubleOutput = new byte[]{(byte) 0xa9, 0x6c, 0x72}; assertArrayEquals(testDoubleOutput, RileyLinkUtil.composeRFStream(testDouble)); byte[] testTriple = new byte[]{(byte) 0xa7, 0x12, (byte) 0xa7}; byte[] testTripleOutput = new byte[]{(byte) 0xa9, 0x6c, 0x72, (byte) 0xa9, 0x60}; assertArrayEquals(testTripleOutput, RileyLinkUtil.composeRFStream(testTriple)); }
public static int composeRFBytes(final byte b) { int lowNibble = b & 0x0F; byte lowCode = CodeSymbols[lowNibble]; int highNibble = (b & 0xF0) >> 4; byte highCode = CodeSymbols[highNibble]; byte highByte = (byte) (((highCode << 2) & 0xFC) | ((lowCode & 0x30) >> 4)); byte lowByte = (byte) ((lowCode & 0x0f) << 4); int rval = highByte; rval = rval << 8; rval = rval | (lowByte & 0xFF); return rval; }
RileyLinkUtil { public static int composeRFBytes(final byte b) { int lowNibble = b & 0x0F; byte lowCode = CodeSymbols[lowNibble]; int highNibble = (b & 0xF0) >> 4; byte highCode = CodeSymbols[highNibble]; byte highByte = (byte) (((highCode << 2) & 0xFC) | ((lowCode & 0x30) >> 4)); byte lowByte = (byte) ((lowCode & 0x0f) << 4); int rval = highByte; rval = rval << 8; rval = rval | (lowByte & 0xFF); return rval; } }
RileyLinkUtil { public static int composeRFBytes(final byte b) { int lowNibble = b & 0x0F; byte lowCode = CodeSymbols[lowNibble]; int highNibble = (b & 0xF0) >> 4; byte highCode = CodeSymbols[highNibble]; byte highByte = (byte) (((highCode << 2) & 0xFC) | ((lowCode & 0x30) >> 4)); byte lowByte = (byte) ((lowCode & 0x0f) << 4); int rval = highByte; rval = rval << 8; rval = rval | (lowByte & 0xFF); return rval; }  }
RileyLinkUtil { public static int composeRFBytes(final byte b) { int lowNibble = b & 0x0F; byte lowCode = CodeSymbols[lowNibble]; int highNibble = (b & 0xF0) >> 4; byte highCode = CodeSymbols[highNibble]; byte highByte = (byte) (((highCode << 2) & 0xFC) | ((lowCode & 0x30) >> 4)); byte lowByte = (byte) ((lowCode & 0x0f) << 4); int rval = highByte; rval = rval << 8; rval = rval | (lowByte & 0xFF); return rval; }  static int computeNewSize(final int inputSize); static byte[] composeRFStream(final byte[] input); static int composeRFBytes(final byte b); }
RileyLinkUtil { public static int composeRFBytes(final byte b) { int lowNibble = b & 0x0F; byte lowCode = CodeSymbols[lowNibble]; int highNibble = (b & 0xF0) >> 4; byte highCode = CodeSymbols[highNibble]; byte highByte = (byte) (((highCode << 2) & 0xFC) | ((lowCode & 0x30) >> 4)); byte lowByte = (byte) ((lowCode & 0x0f) << 4); int rval = highByte; rval = rval << 8; rval = rval | (lowByte & 0xFF); return rval; }  static int computeNewSize(final int inputSize); static byte[] composeRFStream(final byte[] input); static int composeRFBytes(final byte b); static final byte[] CodeSymbols; }