package easy;
//Sum of first 1000 primes
public class SumPrime {
public static void main(String[]args){
	int num = 10;
	int sum=0;
	int[] aprime=getPrime(num);
	for (int i : aprime) {
		sum = sum + i;
	}
	System.out.println("the sum of the prime till 1000 is : "+ sum);
}

private static int[] getPrime(int num) {
	int[] anum= new int[num];
	for (int i = 0; i < anum.length; i++) {
		anum[i]=i;
	}
	anum[1]=0;
	for (int i = 2; i < anum.length; i++) {
		for (int j = 2; j <= (anum.length-1)/i; j++) {
			anum[i*j]=0;
		}
	}
	return anum;
}
}

@@ -1,322 +1,240 @@
 p
-ackage easy;%0A//Sum of first 1000 primes%0Apublic class SumPrime %7B%0Apublic static void main(String%5B%5Dargs)%7B%0A%09int num = 10;%0A%09int sum=0;%0A%09int%5B%5D aprime=getPrime(num);%0A%09for (int i : aprime) %7B%0A%09%09sum = sum + i;%0A%09%7D%0A%09System.out.println(%22the sum of the prime till 1000 is : %22+ sum);%0A%7D%0A%0Aprivate static int%5B%5D getPrime
+ublic class Main%7B%0A    int num=1000;%0Apublic static void main(String%5B%5Dargs)%7B%0A%09for(int i=1000;i%3E2;--i)%7B%0A%09%09if(isPrime(i)&& isPalindrom(i))%7B%0A%09%09%09%09System.out.println(i);%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0Aprivate static boolean isPalindrom
 (int 
-num
+i
 ) %7B%0A%09int
 %5B%5D a
@@ -233,142 +233,193 @@
 %09int
-%5B%5D anum= new int%5Bnum%5D;%0A%09for (int i = 0; i %3C anum.length; i++) %7B%0A%09%09anum%5Bi%5D=i;%0A%09%7D%0A%09anum%5B1%5D=0;%0A%09for (int i = 2; i %3C anum.length; i++) %7B%0A%09
+ rec=i;%0A%09int copy=0;%0A%09while(i%3E0)%7B%0A%09%09int rec1=i%2510;%0A%09%09copy=copy*10+rec1;%0A%09%09i=i/10;%0A%09%7D%0A%09return copy==rec;%0A%7D%0Aprivate static boolean isPrime(int i) %7B%0A%09if(i%252 == 0 %7C%7C i%253 == 0)return false;%0A
 %09for
@@ -432,77 +432,82 @@
 j = 
-2
+5
 ; j
+*j
  %3C= 
-(anum.length-1)/
 i; j+
-+
+=2
 ) %7B%0A%09%09
-%09anum%5Bi*j%5D=0
+if(i%25j == 0)%7B%0A%09%09%09return false
 ;%0A%09%09%7D%0A%09
-%7D
+%09
 %0A%09
+%7D
 return 
-anum
+true
 ;%0A%7D%0A

Improve Performance