Fixed decimal numbers with JAVA

前端 未结 4 2060
感动是毒
感动是毒 2021-01-13 05:10

How do I represent numbers in the format

001 = 1
002 = 2
003 = 3
010 = 10
020 = 20

The number of digits is always 3.

4条回答
  •  时光取名叫无心
    2021-01-13 06:05

    Integer.valueOf("020") is sufficient for your purpose. It will give you 20 as a result. After that you can use it as Integer, int or String.

提交回复
热议问题