@Test public void fillTest() { assertEquals("10", fillWithZero(10, 0)); assertEquals("00000010", fillWithZero(10, 8)); assertEquals("00000010", fillWithZero(10.0d, 8)); assertEquals("00000010", fillWithZero(10.01d, 8)); }
public static String fillWithZero(Number aim, int num) { String zeros = ""; if (num > 0) { int count = 0; while (count < num) { zeros = zeros.concat(ZERO); count++; } return new DecimalFormat(zeros).format(aim); } return aim.toString(); }
StrUtils { public static String fillWithZero(Number aim, int num) { String zeros = ""; if (num > 0) { int count = 0; while (count < num) { zeros = zeros.concat(ZERO); count++; } return new DecimalFormat(zeros).format(aim); } return aim.toString(); } }
StrUtils { public static String fillWithZero(Number aim, int num) { String zeros = ""; if (num > 0) { int count = 0; while (count < num) { zeros = zeros.concat(ZERO); count++; } return new DecimalFormat(zeros).format(aim); } return aim.toString(); } private  StrUtils(); }
StrUtils { public static String fillWithZero(Number aim, int num) { String zeros = ""; if (num > 0) { int count = 0; while (count < num) { zeros = zeros.concat(ZERO); count++; } return new DecimalFormat(zeros).format(aim); } return aim.toString(); } private  StrUtils(); static String fillWithZero(Number aim, int num); static String getMainValue(String suppressCode, int headIndex, String needRemoved); static boolean isEmpty(final String s); static boolean isNotEmpty(final String s); static boolean isBlank(String s); static boolean isNotBlank(String s); static String cutStartStr(String origin, String start); static String cutMiddleStr(String origin, String middle); static String cutTailStr(String origin, String tail); static LinkedList<String> splitMulti(String origin, final String... separators); static boolean isLike(final String origin, final String aim, final String... ignores); static boolean isNumber(final String s); static String str2Hex(String s); static String hex2Str(String s); static String compression(String s); }
StrUtils { public static String fillWithZero(Number aim, int num) { String zeros = ""; if (num > 0) { int count = 0; while (count < num) { zeros = zeros.concat(ZERO); count++; } return new DecimalFormat(zeros).format(aim); } return aim.toString(); } private  StrUtils(); static String fillWithZero(Number aim, int num); static String getMainValue(String suppressCode, int headIndex, String needRemoved); static boolean isEmpty(final String s); static boolean isNotEmpty(final String s); static boolean isBlank(String s); static boolean isNotBlank(String s); static String cutStartStr(String origin, String start); static String cutMiddleStr(String origin, String middle); static String cutTailStr(String origin, String tail); static LinkedList<String> splitMulti(String origin, final String... separators); static boolean isLike(final String origin, final String aim, final String... ignores); static boolean isNumber(final String s); static String str2Hex(String s); static String hex2Str(String s); static String compression(String s); static final String ZERO; static final String HEX; static final String COLON; static final String COMMA; static final String DOUBLE_TRANSFER; static final String PLUS; static final String MINUS; static final char POINT; static final String NEXT_LINE; }