Java tutorial
//package com.java2s; public class Main { /** * @param uid * @return */ public static String getUserUid(int uid) { String uidStr = String.valueOf(uid); StringBuffer sb = new StringBuffer(); for (int i = 0; i < 6 - uidStr.length(); i++) { sb.append("0"); } sb.append(uidStr); return sb.toString(); } }