将数字转换成字符串

public static String getNumberString(int num){

   char[] numchar = String.valueof(num).toCharArray();

   if(numberchar.length == 12)

  {

       return String.valueof(numberchar);

  }

  char[] retcharArr = new char[12];

  Arrays.fill(retcharArr,"0");

  System.arraycopy(numchar,0,retcharArr,12-numchar.length,numchar.length);

  return String.valueof(retcharArr);

}

你可能感兴趣的:(字符串)