Skip to content

Instantly share code, notes, and snippets.

@iamsixer
Last active April 12, 2017 05:50
Show Gist options
  • Select an option

  • Save iamsixer/98fe88c63c6645d9b68e424c070ea4d9 to your computer and use it in GitHub Desktop.

Select an option

Save iamsixer/98fe88c63c6645d9b68e424c070ea4d9 to your computer and use it in GitHub Desktop.
1、
/**
 * @desccroption:把1转换为001或者把001转换为1
 * @date: 2017年4月12日 下午1:48:30
 * void
 */
private static void NumFormat1() {
      int a = 1;  
      DecimalFormat f = new DecimalFormat("000");//确定格式,把1转换为001  
      String s = f.format(a);  
      System.out.println(s);  

      int m = Integer.parseInt(s);//把001转换为1  
      System.out.println(m);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment