Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Define array: Randomly generate an array of 15 numbers from 10 to 99, and output them in the List
Define array: Randomly generate an array of 15 numbers from 10 to 99, and output them in the List

The java code is as follows:

int len ??= 15;

List list = new ArrayList(len);

< p> while (list.size() < len) {

double d = 100 * Math.random();

int i = (int) d;

if (i >= 10 && i <= 99)

list.add(i);

}

for (Integer a : list ) {

System.out.println(a);

}