import java.text.DecimalFormat;
//(1)、如果数字1是字符串,如下处理:
         String str1="1";
 DecimalFormat df=new DecimalFormat("0000");
     String str2=df.format(Integer.parseInt(str1));
     System.out.println(str2);
//(2)、如果数字1是整型,如下处理:
         int str1=1;
 DecimalFormat df=new DecimalFormat("0000");
     String str2=df.format(str1);
     System.out.println(str2);

出处:https://blog.csdn.net/u012626724/article/details/50957133/

相关文章:

  • 2021-06-12
  • 2021-11-22
  • 2022-12-23
  • 2021-04-18
  • 2022-03-08
  • 2022-12-23
  • 2022-02-01
  • 2021-08-20
猜你喜欢
  • 2021-06-27
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案