Java tutorial
//package com.java2s; public class Main { private static String longTile(final int tile, final boolean makeLong) { if (makeLong) { String lt = String.valueOf(tile); while (lt.length() < 4) { lt = "0" + lt; } return lt; } else { return String.valueOf(tile); } } }