Here you can find the source of unsignedZerofill(Integer number, int offset)
Parameter | Description |
---|---|
number | The integer number to be converted into a zerofill representation |
offset | The offset of the zerofill representation |
public static String unsignedZerofill(Integer number, int offset)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w w w .j a v a 2 s . com*/ * Converts an integer to a unsigned zerofill representation specified by the given offset. * E.g. Int(1)/Offset 4 will be converted to String(0001) * * @param number The integer number to be converted into a zerofill representation * @param offset The offset of the zerofill representation * @return Zerofill representation of the given integer number */ public static String unsignedZerofill(Integer number, int offset) { String result = ""; while (result.length() < (offset - number.toString().length())) { result += "0"; } return result + number.toString(); } }