You would want to do this with a for loop, I think.

for (int i = 0; i < 500; i++) {
System.out.println(i);
}

Unless you're practicing while/if, in which case I'm not sure.