code: public static int getNumberCode(int length) {//-2147483648~2147483647
          if(length > 9)
              new Exception("The number is too big");
          Random random = new Random();
          StringBuffer max = new StringBuffer().append("8");
          StringBuffer min = new StringBuffer().append("1");
          while (max.length() <= length - 1) {
              max.append("9");
              min.append("0");
          }
          int maxNumber = Integer.parseInt(max.toString());
          int minNumber = Integer.parseInt(min.toString());
          return random.nextInt(maxNumber) + minNumber;
      }
docs: 自定义长度的数字验证码
  
  @param length 验证码位数长度
  @return 返回生成的数字验证码