I need to write a program to find the first 10 prime numbers, i.e. integers that are only evenly divisible by themselves and 1. The hint I got was to make a big array of booleans named "isprime" and mark off all the non-prime numbers as false, i.e. isprime[4] = false. Here's what I have but it's just printing all of the numbers anyway.
public class PrimeFinder
{
public static void main(String[] args)
{
boolean[] isprime = new boolean[100];
for(int i = 2; i < isprime.length; i++)
{
if(i-1 % i == 0)
{
isprime[i] = false;
}
isprime[i] = true;
}
for(int j = 0; j < isprime.length; j++)
{
if(isprime[j] == true){
System.out.print(j);
System.out.print(", ");
}
}
}
}