I'm looking forward to some tips on how to improve this code I wrote. Don't rewrite it yourself please, as I'm really not looking for someone else to do my homework. What advice would you give me?
import java.util.Random;
public class CompareTo {
public static void main(String[] args) {
int x;
int y;
int[] ints = new int[5];
boolean b1 = false;
boolean b2 = false;
Random r = new Random();
if (args.length < 2) {
System.err.println("You must enter 2 integers.");
System.exit(0);
}
for (int i = 0; i < ints.length; i++) {
ints[i] = r.nextInt(4);
}
try {
x = Integer.parseInt(args[0]);
y = Integer.parseInt(args[1]);
for (int i = 0; i < ints.length; i++) {
if (x == ints[i]) {
b1 = true;
}
if (y == ints[i]) {
b2 = true;
}
}
} catch (NumberFormatException n) {
System.err.println("Not a number.");
System.exit(1);
}
if (b1 && b2) {
System.out.println("Found a match.");
}
}
}
Thank you.