test_class.file: a-foundation/src/test/java/com/ajjpj/afoundation/util/StringHelperTest.java
test_class.identifier: StringHelperTest
test_case.body: @Test
      public void testHexStringToByteArray() {
          assertEquals(null, StringHelper.hexStringToByteArray(null));
          assertEq(new byte[]{}, StringHelper.hexStringToByteArray(""));
          assertEq(new byte[]{0, 1, 2}, StringHelper.hexStringToByteArray("000102"));
          assertEq(new byte[]{14, 15, 16}, StringHelper.hexStringToByteArray("0E0F10"));
          assertEq(new byte[]{-128, -1}, StringHelper.hexStringToByteArray("80FF"));
  
          assertEq(new byte[]{26}, StringHelper.hexStringToByteArray("1a"));
          assertEq(new byte[]{-2}, StringHelper.hexStringToByteArray("fE"));
  
          try {
              StringHelper.hexStringToByteArray("1");
              fail("exception expected");
          } catch (Exception e) {
              // expected
          }
  
          try {
              StringHelper.hexStringToByteArray("1X");
              fail("exception expected");
          } catch (Exception e) {
              // expected
          }
  
          try {
              StringHelper.hexStringToByteArray("X1");
              fail("exception expected");
          } catch (Exception e) {
              // expected
          }
      }
test_case.class_method_signature: StringHelperTest.testHexStringToByteArray()
test_case.full_signature: @Test public void testHexStringToByteArray()
test_case.identifier: testHexStringToByteArray
test_case.invocations: assertEquals hexStringToByteArray assertEq hexStringToByteArray assertEq hexStringToByteArray assertEq hexStringToByteArray assertEq hexStringToByteArray assertEq hexStringToByteArray assertEq hexStringToByteArray hexStringToByteArray fail hexStringToByteArray fail hexStringToByteArray fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testHexStringToByteArray()
focal_class.declarator: hexArray = "0123456789ABCDEF".toCharArray()
focal_class.modifier: private static final
focal_class.original_string: private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
focal_class.type: char[]
focal_class.var_name: hexArray
focal_class.file: a-foundation/src/main/java/com/ajjpj/afoundation/util/StringHelper.java
focal_class.identifier: StringHelper
focal_class.class_method_signature: StringHelper.bytesToHexString(byte[] bytes)
focal_class.full_signature: public static String bytesToHexString(byte[] bytes)
focal_class.identifier: bytesToHexString
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes)
focal_class.return: String
focal_class.signature: String bytesToHexString(byte[] bytes)
focal_class.class_method_signature: StringHelper.hexStringToByteArray(String s)
focal_class.full_signature: public static byte[] hexStringToByteArray(String s)
focal_class.identifier: hexStringToByteArray
focal_class.modifiers: public static
focal_class.parameters: (String s)
focal_class.return: byte[]
focal_class.signature: byte[] hexStringToByteArray(String s)
focal_method.body: public static byte[] hexStringToByteArray(String s) {
          if(s == null) {
              return null;
          }
  
          final int len = s.length();
          final byte[] data = new byte[len / 2];
          for (int i = 0; i < len; i += 2) {
              final int hiNibble = Character.digit(s.charAt(i),   16);
              final int loNibble = Character.digit(s.charAt(i+1), 16);
  
              if(hiNibble < 0 || loNibble < 0) {
                  throw new IllegalArgumentException("no valid hex number at offset " + i);
              }
  
              data[i / 2] = (byte) ((hiNibble << 4) + loNibble);
          }
          return data;
      }
focal_method.class_method_signature: StringHelper.hexStringToByteArray(String s)
focal_method.full_signature: public static byte[] hexStringToByteArray(String s)
focal_method.identifier: hexStringToByteArray
focal_method.invocations: length digit charAt digit charAt
focal_method.modifiers: public static
focal_method.parameters: (String s)
focal_method.return: byte[]
focal_method.signature: byte[] hexStringToByteArray(String s)