code: private static void append(StringBuilder sb, int val, int width) {
      String s = Integer.toString(val);
      for (int i = s.length(); i < width; i++) sb.append('0');
      sb.append(s);
    }
docs: Append the given value to the string builder, with leading zeros to result in the given minimum width.