Here you can find the source of zeroAlign(String x, int count)
static String zeroAlign(String x, int count)
//package com.java2s; //License from project: Open Source License public class Main { static String zeroAlign(String x, int count) { if (x.length() < count) { int spaces = count - x.length(); StringBuilder result = new StringBuilder(count); while (spaces > 0) { result.append("0"); spaces--;//from w w w .j a va 2 s.c o m } result.append(x); return result.toString(); } else { return x; } } }