@Test(expected=IllegalArgumentException.class) public void toBcdWithStringInvalidDigits() { byte[] bytes0 = GsmUtil.toBcd("131 5554272"); }
public static byte[] toBcd(String address) throws NullPointerException, IllegalArgumentException { if (address == null) { throw new NullPointerException("Address cannot be null for BCD encoding"); } if (!StringUtil.containsOnlyDigits(address)) { throw new IllegalArgumentException("Address must only contain digits"); } if (address.length() % 2 != 0) { address = address + "F"; } int bytes_len = address.length() / 2; byte[] bcd = new byte[bytes_len]; for (int i = 0; i < bytes_len; i++) { StringBuilder chunk = new StringBuilder(address.substring(i * 2, (i * 2) + 2)); chunk.reverse(); byte[] bytes = HexUtil.toByteArray(chunk.toString()); bcd[i] = bytes[0]; } return bcd; }
GsmUtil { public static byte[] toBcd(String address) throws NullPointerException, IllegalArgumentException { if (address == null) { throw new NullPointerException("Address cannot be null for BCD encoding"); } if (!StringUtil.containsOnlyDigits(address)) { throw new IllegalArgumentException("Address must only contain digits"); } if (address.length() % 2 != 0) { address = address + "F"; } int bytes_len = address.length() / 2; byte[] bcd = new byte[bytes_len]; for (int i = 0; i < bytes_len; i++) { StringBuilder chunk = new StringBuilder(address.substring(i * 2, (i * 2) + 2)); chunk.reverse(); byte[] bytes = HexUtil.toByteArray(chunk.toString()); bcd[i] = bytes[0]; } return bcd; } }
GsmUtil { public static byte[] toBcd(String address) throws NullPointerException, IllegalArgumentException { if (address == null) { throw new NullPointerException("Address cannot be null for BCD encoding"); } if (!StringUtil.containsOnlyDigits(address)) { throw new IllegalArgumentException("Address must only contain digits"); } if (address.length() % 2 != 0) { address = address + "F"; } int bytes_len = address.length() / 2; byte[] bcd = new byte[bytes_len]; for (int i = 0; i < bytes_len; i++) { StringBuilder chunk = new StringBuilder(address.substring(i * 2, (i * 2) + 2)); chunk.reverse(); byte[] bytes = HexUtil.toByteArray(chunk.toString()); bcd[i] = bytes[0]; } return bcd; }  }
GsmUtil { public static byte[] toBcd(String address) throws NullPointerException, IllegalArgumentException { if (address == null) { throw new NullPointerException("Address cannot be null for BCD encoding"); } if (!StringUtil.containsOnlyDigits(address)) { throw new IllegalArgumentException("Address must only contain digits"); } if (address.length() % 2 != 0) { address = address + "F"; } int bytes_len = address.length() / 2; byte[] bcd = new byte[bytes_len]; for (int i = 0; i < bytes_len; i++) { StringBuilder chunk = new StringBuilder(address.substring(i * 2, (i * 2) + 2)); chunk.reverse(); byte[] bytes = HexUtil.toByteArray(chunk.toString()); bcd[i] = bytes[0]; } return bcd; }  static byte[] toBcd(String address); static byte toSubmitInfo(boolean replyPath, boolean udhIndicator,
            boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates); static byte[] removeUserDataHeader(byte[] shortMessage); static byte[] getShortMessageUserData(byte[] shortMessage); static byte[] getShortMessageUserDataHeader(byte[] shortMessage); static byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum); }
GsmUtil { public static byte[] toBcd(String address) throws NullPointerException, IllegalArgumentException { if (address == null) { throw new NullPointerException("Address cannot be null for BCD encoding"); } if (!StringUtil.containsOnlyDigits(address)) { throw new IllegalArgumentException("Address must only contain digits"); } if (address.length() % 2 != 0) { address = address + "F"; } int bytes_len = address.length() / 2; byte[] bcd = new byte[bytes_len]; for (int i = 0; i < bytes_len; i++) { StringBuilder chunk = new StringBuilder(address.substring(i * 2, (i * 2) + 2)); chunk.reverse(); byte[] bytes = HexUtil.toByteArray(chunk.toString()); bcd[i] = bytes[0]; } return bcd; }  static byte[] toBcd(String address); static byte toSubmitInfo(boolean replyPath, boolean udhIndicator,
            boolean deliveryReceipt, int validityPeriodFormat, boolean rejectDuplicates); static byte[] removeUserDataHeader(byte[] shortMessage); static byte[] getShortMessageUserData(byte[] shortMessage); static byte[] getShortMessageUserDataHeader(byte[] shortMessage); static byte[][] createConcatenatedBinaryShortMessages(byte[] binaryShortMessage, byte referenceNum);  }