Java Zero Format zeroSupply(String value, int len)

Here you can find the source of zeroSupply(String value, int len)

Description

zero Supply

License

Open Source License

Declaration

public static String zeroSupply(String value, int len) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * @(#)DateFormatUtil.java 2012-3-12/*w  w w . java  2  s.c o  m*/
 *
 * Copyright 2012 Neusoft Group Ltd. All rights reserved.
 * Neusoft PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *******************************************************************************/

public class Main {

    public static String zeroSupply(String value, int len) {
        if (value == null) {
            return value;
        }
        String supply = "";
        for (int i = value.length(); i < len; i++) {
            supply = supply + "0";
        }

        return supply + value;

    }
}

Related

  1. zeros(int n)
  2. zeros(int size)
  3. zerosInt(int len)
  4. zeroString(int length)
  5. zeroString(int value)
  6. zeroThrough(int max)
  7. zeroToOne(float value, float min, float max)
  8. zeroToOne(long _min, long _max, long _value)
  9. zeroToSpace(String s)