Java Zero Format zeroFill(int iv, int len)

Here you can find the source of zeroFill(int iv, int len)

Description

zero Fill

License

Open Source License

Declaration

public static String zeroFill(int iv, int len) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static String zeroFill(int iv, int len) {
        String v = String.valueOf(iv);
        if (v.length() < len) {
            StringBuilder bd = new StringBuilder(v);
            for (int i = 0; i < len - v.length(); i++) {
                bd.insert(0, '0');
            }/*from   w w  w  .j  a  va 2  s .  co  m*/
            return bd.toString();
        } else {
            return v;
        }
    }
}

Related

  1. zeroDiv(double numerator, double denominator)
  2. zeroes(final int ch)
  3. zeroEsquerda(String s1, int tamString)
  4. zeroExtend(long value, int inputBits)
  5. zeroFill(float[] array)
  6. zeroFill(int num, int size, String character)
  7. zeroFill(int value, int fieldWidth)
  8. zerofill(int x, int desiredWidth)
  9. zeroFillString(String originalString, int numZeros)