Java Zero Format zeroPrefix(String str, int width)

Here you can find the source of zeroPrefix(String str, int width)

Description

zero Prefix

License

Open Source License

Declaration

public static String zeroPrefix(String str, int width) 

Method Source Code

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

public class Main {
    public static String zeroPrefix(String str, int width) {
        return prefix(str, '0', width);
    }//from   w w  w.j av a  2s . com

    public static String zeroPrefix(long l, int width) {
        return prefix(String.valueOf(l), '0', width);
    }

    public static String prefix(String str, char prefix, int width) {
        StringBuffer ret = new StringBuffer(str);
        while (ret.length() < width)
            ret.insert(0, prefix);
        return ret.toString();
    }
}

Related

  1. ZeroOneStringToBooleanArray(String data)
  2. zeroOrderBessel(float num)
  3. zeroOrMore(String... patterns)
  4. zeroOut(byte[] array)
  5. ZeroPoleFilter(float In[], int In_idx, float ZeroCoef[], float PoleCoef[], int PoleCoef_idx, int lengthInOut, int orderCoef, float Out[], int Out_idx)
  6. zeroPrepend(long num, int digits)
  7. ZeroRemover(String[] a)
  8. zeros(int n)
  9. zeros(int size)