Java Integer Pad Zero zeroPad(int value, int padding)

Here you can find the source of zeroPad(int value, int padding)

Description

zero Pad

License

Open Source License

Declaration

private static String zeroPad(int value, int padding) 

Method Source Code

//package com.java2s;

public class Main {
    private static String zeroPad(int value, int padding) {
        StringBuilder b = new StringBuilder();
        b.append(value);/*ww w.  j a  va 2 s.com*/
        while (b.length() < padding) {
            b.insert(0, "0");
        }
        return b.toString();
    }
}

Related

  1. zeroPad(int i, int len)
  2. zeroPad(int n, int base, int width)
  3. zeroPad(int n, int len)
  4. zeroPad(int number, int places)
  5. ZeroPad(int number, int width)
  6. zeroPadArray(byte[] source, int size)
  7. ZeroPadded(Integer i)
  8. zeroPaddedHex(int n, int length)
  9. zeroPaddedInt(int num, int length)