KnxEncoder { public static String convertGroupAddressToHex(String address) { String dest = "0000"; String vectorAddress[] = address.split("[/]"); int main = Integer.parseInt(vectorAddress[0]); int middle = Integer.parseInt(vectorAddress[1]); int highInt = 0; int sub = Integer.parseInt(vectorAddress[2]); main = main & 0x1f; main <<= 3; middle = middle & 0x7; highInt = main + middle; String highHex = Integer.toHexString(highInt); if (highInt < 16) highHex = "0" + highHex; String lowHex = Integer.toHexString(sub); if (sub < 16) lowHex = "0" + lowHex; dest = highHex + lowHex; return dest; }  static byte[] encode(boolean repeatBit, byte[] sourceByte, String targetAddress, byte[] dataByte,
			KnxCommand commandType, boolean multicast); static KnxTelegram decode(byte knxMessage[]); static byte[] removeTrailingZeros(byte[] original); static String convertDeviceAddressToHex(String address); static String convertGroupAddressToHex(String address); static byte[] convertToByteArray(String hexString); static String convertToReadableHex(byte[] b); static String convertToHex(byte[] b); static String convertGroupAddressToReadable(byte buffer[]); static String clearHexValue(String hexValue);  }
@Test public void createGroupAddressTest() { assertTrue( "KnxEncoder.createGroupAddress('1/2/3') returns " + KnxEncoder.convertGroupAddressToHex("1/2/3") + "; but should return 0a03", KnxEncoder.convertGroupAddressToHex("1/2/3").equalsIgnoreCase("0a03")); assertTrue(KnxEncoder.convertGroupAddressToHex("0/0/2").equalsIgnoreCase("0002")); assertTrue(KnxEncoder.convertGroupAddressToHex("1/1/1").equalsIgnoreCase("0901")); assertTrue(KnxEncoder.convertGroupAddressToHex("29/7/234").equalsIgnoreCase("efea")); }