</pre>自增类型的:<p></p><p><span style="font-family:monospace; white-space:pre; background-color:rgb(240,240,240)">if(baBusinessLinks.getXh().length()==1){baBusinessLinks.setXh("0"+baBusinessLinks.getXh());}</span></p><p>非自增类型的:</p><p><span style="white-space:pre"></span></p><pre name="code" class="java">if (baBusinessLinksList.size()<9)
{
baBusinessLinks.setXh("00"+(Integer.valueOf(baBusinessLinksList.size())+1));
}
公共方法:
/**
* 数字前补0 如: 3位数 1则补0为 001
* @param num 数字
* @param wNum 位数
* @return
*/
public static String zeroToNum(int num,int wNum){
StringBuffer result = new StringBuffer();
String nstring = String.valueOf(num);
for(int i=0;i<wNum-nstring.length();i++){
result.append("0");
}
result.append(nstring);
return result.toString();
}