StringUtil { public static String padLeft(String _value, int _length) { return String.format("%1$" + _length + "s", _value); }  static final String formatMinString(double _d); static final String formatMinString(long _n); static final String formatMBString(double _d); static final String formatKBString(double _d); static final String byteToMBString(double _bytes); static final String byteToKBString(long _bytes); static final String byteToMBString(long _bytes); static final synchronized String formatDate(long _ms); @Deprecated static final String nanoToMinString(long _nano); static final String nanoToFlexDurationString(long _nano); static final String msToMinString(long _ms); static String join(Object[] _objs, String _sep); static String join(String[] _strings, String _sep); static String join(Collection<?> _objs, String _sep); static String padLeft(String _value, int _length); static String padLeft(long _value, int _length); static String padLeft(int _value, int _length); static String padLeft(boolean _value, int _length); static String padLeft(double _value, int _length); static boolean meetsLengthConstraint(String _string, int _length); static final String getRandonString(int _length); static String[] toArray(@NotNull String _string); static boolean isEmptyOrContainsEmptyString(String[] _array); static boolean matchesPattern(String _string, Pattern[] _patterns); static final long KILOBYTE; static final long MEGABYTE; static final long MILLI_IN_MIN; static final long NANOS_IN_MIN; }
@Test public void testPadLeft() { assertEquals(" 1", StringUtil.padLeft(1, 3)); assertEquals( "11111", StringUtil.padLeft(11111, 3)); }