public class Demo{
/**
* 生成1000位的随机数
* @param args
*/
public static String randomNumber() {
StringBuilder num = new StringBuilder();
for (int i = 1; i <= 1000; i++) {
int n = new Random().nextInt(9) + 1;
num.append(n);
}
return num+"" ;
}
public static void main(String[] args) {
BigInteger b1 = new BigInteger(randomNumber());
System.out.println("1000位随机数" + b1);
BigInteger b2 = new BigInteger("7");
BigInteger b3 = b1.mod(b2);// 取余数
System.out.println("结果"+b3);
}
}
/**
* 生成1000位的随机数
* @param args
*/
public static String randomNumber() {
StringBuilder num = new StringBuilder();
for (int i = 1; i <= 1000; i++) {
int n = new Random().nextInt(9) + 1;
num.append(n);
}
return num+"" ;
}
public static void main(String[] args) {
BigInteger b1 = new BigInteger(randomNumber());
System.out.println("1000位随机数" + b1);
BigInteger b2 = new BigInteger("7");
BigInteger b3 = b1.mod(b2);// 取余数
System.out.println("结果"+b3);
}
}