/**
     * 计算整数的位数
     * @param x
     * @return
     */
    public static int countIntegerLength(int x){
        final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
                99999999, 999999999, Integer.MAX_VALUE };

        for (int i=0; ; i++)
            if (x <= sizeTable[i]){
                return i+1;
            }
    }

 

相关文章:

  • 2022-12-23
  • 2021-05-10
  • 2021-07-09
  • 2022-02-13
  • 2021-12-23
  • 2022-01-17
  • 2021-11-23
猜你喜欢
  • 2021-06-19
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案