heavy prime number in java
<ol>
<li>A prime heavy number is defined to be one that is the sum of more than one pair of prime numbers. Recall that a prime number is a number greater than 1 whose only divisors are 1 and itself.
For example, 16 is prime heavy because 16=3+13 and 5+11 (note that 3, 5, 11, and 13 are all prime). 24 is prime heavy because 24 = 5+19, 7+17 and 11+13. However, 8 is not prime heavy because 8 = 3+5 but no other pair of primes sums to 8.
Write a function named isPrimeHeavy that returns 1 if its argument is prime heavy, otherwise it returns 0.
The function signature is
int isPrimeHeavy (int n) 
You may assume that a function named isPrime already exists that returns 1 if its argument is a prime. You can call this function but do not have to write it.</li>
</ol>

<p>I did this but it cant return a heavy prime..just returns a prime number...                                                                   </p>

<pre><code>public class Prime {

    public static boolean isPrimeHeavy(int n) {
        if (n &lt;= 1) {
            return false;
        }
        if (n == 2) {
            return true;
        }
        for (int i = 2; i &lt;= Math.sqrt(n) + 1; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
    public static boolean isPrimeHeavy(int n) {
        if (n &lt;= 1) {
            return false;
        }
        if (n == 2) {
            return true;
        }
        if (n % 2 == 0) {
            return false;
        }
        for (int i = 3; i &lt;= Math.sqrt(n) + 1; i = i + 2) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}

public class PrimeTest {

    public PrimeTest() {
    }

    @Test
    public void testIsPrime() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {

        Prime prime = new Prime();
        TreeMap&lt;Long, String&gt; methodMap = new TreeMap&lt;Long, String&gt;();


        for (Method method : Prime.class.getDeclaredMethods()) {

            long startTime = System.currentTimeMillis();

            int primeCount = 0;
            for (int i = 0; i &lt; 1000000; i++) {
                if ((Boolean) method.invoke(prime, i)) {
                    primeCount++;
                }
            }

            long endTime = System.currentTimeMillis();

            Assert.assertEquals(method.getName() + " failed ", 78498, primeCount);
            methodMap.put(endTime - startTime, method.getName());
        }


        for (Entry&lt;Long, String&gt; entry : methodMap.entrySet()) {
            System.out.println(entry.getValue() + " " + entry.getKey() + " Milli seconds ");
        }
    }
}
</code></pre>
