import java.util.Random; ... Random random = new Random(); System.out.println(n[random.nextInt(n.length)]);