here is first step which is to cheak if number is prime or not using if statement [package primespiral;
import java.io.File;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class Primespiral {
/**
* @param args the command line arguments
*/
public static void main(
String[] args) throws FileNotFoundException {
Scanner infile = new Scanner(new FileReader("spiral.in"));
PrintWriter outfile = new PrintWriter("spiral.out");
//define limit
int size = 100;
//loop through the numbers one by one
for (int i = 0; i < 100; i++) {
boolean isPrime = true;
//check to see if the number is prime
for (int j = 2; j < i; j++) {
if (i % j == 0) {
isPrime = false;
break;
}
}
// print the number
if (isPrime) {
outfile.print(i + " ");
}
}
}
}
]
then how I can found largest sum of primes in diagonal ???