Java Formatter Usage numberWithLeadingZeroes(int n, int totalChars)

Here you can find the source of numberWithLeadingZeroes(int n, int totalChars)

Description

number With Leading Zeroes

License

Open Source License

Declaration

public static String numberWithLeadingZeroes(int n, int totalChars) 

Method Source Code

//package com.java2s;

import java.util.Formatter;

import java.util.Locale;

public class Main {
    public static String numberWithLeadingZeroes(int n, int totalChars) {
        Formatter formatter = new Formatter(Locale.US);
        String suffix = "" + formatter.format("%0" + totalChars + "d", n);
        formatter.close();//from   w w  w  . j av  a 2s.com
        return suffix;
    }
}

Related

  1. incrementAlpha(String suppliedPrefix, String lastNumber, int numberLength)
  2. listToString(List list, String separator)
  3. long2Mac(final long macAddress)
  4. millisToHumanTime(long milliseconds)
  5. msToHumanReadableDelta(long start)
  6. showVxlanHeaderOutput()
  7. substitution(Formatter formatter, int flags, int width, int precision, StringBuilder obj)
  8. toHexString(final byte[] data)
  9. toReadableSize(long bytes)