// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.DecimalFormat;

public class FixedWidth {
    private static final DecimalFormat df = new DecimalFormat("000000");
    public static void main(String[] args) {
        int[] a = { 1, 22, 333, 4444, 55555, 666666 };
        for(int i = 0; i < a.length; i++) {
            System.out.println(df.format(a[i]) + " " + df.format(a[i]).replaceAll("(?<![1-9]d)0", " "));
        }
    }
}
