@Test public void hexStringToIntArray() { ZigBeeCbkeCertificate certificate = Mockito.mock(ZigBeeCbkeCertificate.class, Mockito.CALLS_REAL_METHODS); assertTrue(Arrays.equals(new int[] { 0x12, 0x34, 0x56, 0x78 }, certificate.hexStringToIntArray("12345678"))); }
protected int[] hexStringToIntArray(String hexString) { if (hexString.length() % 2 != 0) { throw new IllegalArgumentException( "Certificate string '" + hexString + "' must be even number of bytes long."); } int[] output = new int[hexString.length() / 2]; char enc[] = hexString.toCharArray(); for (int i = 0; i < enc.length - 1; i += 2) { StringBuilder curr = new StringBuilder(2); curr.append(enc[i]).append(enc[i + 1]); output[i / 2] = Integer.parseInt(curr.toString(), 16); } return output; }
ZigBeeCbkeCertificate { protected int[] hexStringToIntArray(String hexString) { if (hexString.length() % 2 != 0) { throw new IllegalArgumentException( "Certificate string '" + hexString + "' must be even number of bytes long."); } int[] output = new int[hexString.length() / 2]; char enc[] = hexString.toCharArray(); for (int i = 0; i < enc.length - 1; i += 2) { StringBuilder curr = new StringBuilder(2); curr.append(enc[i]).append(enc[i + 1]); output[i / 2] = Integer.parseInt(curr.toString(), 16); } return output; } }
ZigBeeCbkeCertificate { protected int[] hexStringToIntArray(String hexString) { if (hexString.length() % 2 != 0) { throw new IllegalArgumentException( "Certificate string '" + hexString + "' must be even number of bytes long."); } int[] output = new int[hexString.length() / 2]; char enc[] = hexString.toCharArray(); for (int i = 0; i < enc.length - 1; i += 2) { StringBuilder curr = new StringBuilder(2); curr.append(enc[i]).append(enc[i + 1]); output[i / 2] = Integer.parseInt(curr.toString(), 16); } return output; }  }
ZigBeeCbkeCertificate { protected int[] hexStringToIntArray(String hexString) { if (hexString.length() % 2 != 0) { throw new IllegalArgumentException( "Certificate string '" + hexString + "' must be even number of bytes long."); } int[] output = new int[hexString.length() / 2]; char enc[] = hexString.toCharArray(); for (int i = 0; i < enc.length - 1; i += 2) { StringBuilder curr = new StringBuilder(2); curr.append(enc[i]).append(enc[i + 1]); output[i / 2] = Integer.parseInt(curr.toString(), 16); } return output; }  ZigBeeCryptoSuites getCryptoSuite(); int[] getCertificate(); int[] getPrivateKey(); int[] getCaPublicKey(); }
ZigBeeCbkeCertificate { protected int[] hexStringToIntArray(String hexString) { if (hexString.length() % 2 != 0) { throw new IllegalArgumentException( "Certificate string '" + hexString + "' must be even number of bytes long."); } int[] output = new int[hexString.length() / 2]; char enc[] = hexString.toCharArray(); for (int i = 0; i < enc.length - 1; i += 2) { StringBuilder curr = new StringBuilder(2); curr.append(enc[i]).append(enc[i + 1]); output[i / 2] = Integer.parseInt(curr.toString(), 16); } return output; }  ZigBeeCryptoSuites getCryptoSuite(); int[] getCertificate(); int[] getPrivateKey(); int[] getCaPublicKey();  }