I would only say - you have a problem with validation. With a little fix your code would look like:
java
import java.util.Random;
import javax.swing.JOptionPane;
public class hooray {
private static final int max = 500;
private static final int min = 50;
public static void main(String[] args) {
int
maxcrazy = Integer.parseInt(
JOptionPane.showInputDialog("Enter an integer between 50 and 500")
),
maxmax = Integer.MIN_VALUE,
minmin = Integer.MAX_VALUE;
Random gen1 = new Random();
if (maxcrazy > max || maxcrazy < min) {
System.out.println("Crazy number");
System.exit(1);
}
// now the size has been validated, it is a good idea to create the array
int Arr1[] = new int[maxcrazy];
// init all elements of the array and find if new max and/or new min
for (int crazy = 0; crazy < Arr1.length; crazy++) {
Arr1[crazy] = gen1.nextInt(maxcrazy);
System.out.println("Number [" + crazy + "] is " + Arr1[crazy]);
// find min and max
if (maxmax < Arr1[crazy])
maxmax = Arr1[crazy];
if (minmin > Arr1[crazy])
minmin = Arr1[crazy];
}
System.out.println("Max: " + maxmax + " Min: " + minmin);
}
}