code: @Nonnull
      private static String leftpad(@Nonnull String s, int n, char padChar) {
          int diff = n - s.length();
          if (diff <= 0) {
              return s;
          }
          StringBuilder buf = new StringBuilder(n);
  
          for (int i = 0; i < diff; ++i) {
              buf.append(padChar);
          }
          buf.append(s);
          return buf.toString();
      }
docs: Left-pads a String with the specific padChar so it is length <code>n</code>.  If the String
  is already at least length n, no padding is done.