Java之向左添加零(000001)

int i_m = 270000 ;
String str_m = String.valueOf(i_m);
String str ="000000";
str_m=str.substring(0, 6-str_m.length())+str_m;
System.out.println(str_m);

posted @ 2016-06-14 10:46  Sunray0330  阅读(373)  评论(0编辑  收藏  举报