cdm/src/main/java/ucar/unidata/util/StringUtil2.java
public static String padLeft(String s, int desiredLength,
                               String padString) {
    while (s.length() < desiredLength) {
      s = padString + s;
    }
    return s;
  }
public static String padLeft(String s, int desiredLength,
                               String padString) {
    while (s.length() < desiredLength) {
      s = padString + s;
    }
    return s;
  }
Pad the given string with padString on the left up to the given length.

@param s             String to pad
@param desiredLength ending length
@param padString     String to pad with (e.g, " ")
@return padded String