test_class.file: ch-commons-xbean/src/test/java/com/cloudhopper/commons/xbean/util/NumberRadixUtilTest.java
test_class.identifier: NumberRadixUtilTest
test_case.body: @Test
      public void normalizeLeadingHexZeroes() throws Exception {
          // appending digits or equal
          Assert.assertEquals("00", NumberRadixUtil.normalizeLeadingHexZeroes("0", 2));
          Assert.assertEquals("00", NumberRadixUtil.normalizeLeadingHexZeroes("00", 2));
          Assert.assertEquals("0F", NumberRadixUtil.normalizeLeadingHexZeroes("F", 2));
          Assert.assertEquals("FF", NumberRadixUtil.normalizeLeadingHexZeroes("FF", 2));
          Assert.assertEquals("0000", NumberRadixUtil.normalizeLeadingHexZeroes("0", 4));
          Assert.assertEquals("0000", NumberRadixUtil.normalizeLeadingHexZeroes("00", 4));
          Assert.assertEquals("000F", NumberRadixUtil.normalizeLeadingHexZeroes("F", 4));
          Assert.assertEquals("00FF", NumberRadixUtil.normalizeLeadingHexZeroes("FF", 4));
          Assert.assertEquals("0FFF", NumberRadixUtil.normalizeLeadingHexZeroes("FFF", 4));
          Assert.assertEquals("FFFF", NumberRadixUtil.normalizeLeadingHexZeroes("FFFF", 4));
          Assert.assertEquals("00000000", NumberRadixUtil.normalizeLeadingHexZeroes("0", 8));
          Assert.assertEquals("00000000", NumberRadixUtil.normalizeLeadingHexZeroes("00", 8));
          Assert.assertEquals("0000000F", NumberRadixUtil.normalizeLeadingHexZeroes("F", 8));
          Assert.assertEquals("000000FF", NumberRadixUtil.normalizeLeadingHexZeroes("FF", 8));
          Assert.assertEquals("00000FFF", NumberRadixUtil.normalizeLeadingHexZeroes("FFF", 8));
          Assert.assertEquals("0000FFFF", NumberRadixUtil.normalizeLeadingHexZeroes("FFFF", 8));
          Assert.assertEquals("FFFFFFFF", NumberRadixUtil.normalizeLeadingHexZeroes("FFFFFFFF", 8));
          // trimming digits
          Assert.assertEquals("00", NumberRadixUtil.normalizeLeadingHexZeroes("000", 2));
          Assert.assertEquals("00", NumberRadixUtil.normalizeLeadingHexZeroes("0000", 2));
          Assert.assertEquals("0F", NumberRadixUtil.normalizeLeadingHexZeroes("00F", 2));
          Assert.assertEquals("FF", NumberRadixUtil.normalizeLeadingHexZeroes("000000000FF", 2));
      }
test_case.class_method_signature: NumberRadixUtilTest.normalizeLeadingHexZeroes()
test_case.full_signature: @Test public void normalizeLeadingHexZeroes()
test_case.identifier: normalizeLeadingHexZeroes
test_case.invocations: assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes assertEquals normalizeLeadingHexZeroes
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void normalizeLeadingHexZeroes()
focal_class.file: ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/NumberRadixUtil.java
focal_class.identifier: NumberRadixUtil
focal_class.class_method_signature: NumberRadixUtil.parseNumberRadix(String number)
focal_class.full_signature: static public NumberRadixResult parseNumberRadix(String number)
focal_class.identifier: parseNumberRadix
focal_class.modifiers: static public
focal_class.parameters: (String number)
focal_class.return: NumberRadixResult
focal_class.signature: NumberRadixResult parseNumberRadix(String number)
focal_class.class_method_signature: NumberRadixUtil.normalizeLeadingHexZeroes(String v, int length)
focal_class.full_signature: static public String normalizeLeadingHexZeroes(String v, int length)
focal_class.identifier: normalizeLeadingHexZeroes
focal_class.modifiers: static public
focal_class.parameters: (String v, int length)
focal_class.return: String
focal_class.signature: String normalizeLeadingHexZeroes(String v, int length)
focal_method.body: static public String normalizeLeadingHexZeroes(String v, int length) throws ConversionException {
          if (v == null || v.length() == 0) {
              throw new ConversionException("Empty or null value detected; unable to convert");
          } else if (v.length() == length) {
              return v;
          } else if (v.length() < length) {
              // add leading zeroes
              int prepend = (length - v.length());
              StringBuilder sb = new StringBuilder(length);
              for (int i = 0; i < prepend; i++) {
                  sb.append('0');
              }
              sb.append(v);
              return sb.toString();
          } else {
              // remove leading zeroes (or error out if not zeroes)
              int remove = (v.length() - length);
              // check if any of these are non-zero
              for (int i = 0; i < remove; i++) {
                  if (v.charAt(i) != '0') {
                      throw new ConversionOverflowException("Overflow of value detected; unable to trim value [" + v + "] to length " + length);
                  }
              }
              return v.substring(remove);
          }
      }
focal_method.class_method_signature: NumberRadixUtil.normalizeLeadingHexZeroes(String v, int length)
focal_method.full_signature: static public String normalizeLeadingHexZeroes(String v, int length)
focal_method.identifier: normalizeLeadingHexZeroes
focal_method.invocations: length length length length append append toString length charAt substring
focal_method.modifiers: static public
focal_method.parameters: (String v, int length)
focal_method.return: String
focal_method.signature: String normalizeLeadingHexZeroes(String v, int length)