Q:

Passing random.nextInt() as a parameter causes strange problems

I am trying to pass a random integer to a constructor.
hotels[2] = new Hotel(random.nextInt(10)+30, random.nextInt()+100, 
                random.nextInt()+20, random.nextInt()+200, 
                random.nextInt()+10, random.nextInt()+300);

However, in the DataPoint constructor, the values being passed inside were ridiculous, i.e.
Params 1, 3, 5:      38   -695807826   -2078518332

Getting -695807826 makes no sense. The number should be between 20 and 40, because of random.nextInt()+20

A:

This is simply because after the first argument, you forgot to add a parameter to nextInt
Your call should be:
hotels[2] = new Hotel(random.nextInt(10)+30, random.nextInt(10)+100, 
                random.nextInt(10)+20, random.nextInt(10)+200, 
                random.nextInt(10)+10, random.nextInt(10)+300);

A:

If you do something like random.nextInt()+300 and the result of the random.nextInt() call is within 300 of the maximum integer value, you'll get overflow and the result will be interpreted as a negative number.

