random numbers previously established (java)

The following code shows 4 int variables:

  int xy1 = 724329;
  int xy2 = 714385;
  int xy3 = 715440;
  int xy4 = 696492;

I'm pretending to code an app that, by opening it, shows one of those numbers (NOT numbers between them) on java console, randomly. I know that Math.Random class can be used to solve these kind of issues, but I don't know what is the proper way to do so.

So, thanks.

Jon Skeet
people
quotationmark

Well it sounds like you just want a collection of possible values, and an index between 0 and 3 inclusive:

int[] values = { 724329, 714385, 715440, 696492 };
Random random = new Random(); // Ideally initialize once for the entire app
int index = random.nextInt(4);
int value = values[index];

people

See more on this question at Stackoverflow