Achilles Number in Java

An Achilles Number is a number that is powerful but not a perfect power. A Powerful Number is a positive integer N, such that for every prime factor p of N, p2 is also a factor. A Perfect Power is a positive integer N such that it can be expressed as ab, where a and b are natural numbers > 1. 72, 108, 200, 288 are some of the first few Achilles Numbers. The prime factors of 72 = 2 × 2 × 2 × 3 × 3. Both 2 and 22 = 4 are factors of 72. Both 3 and 32 = 9 are factors of 72. Also, 72 can’t be represented as ab. Therefore, 72 is an Achilles Number. Write a program in Java to input an integer from the user and check whether it is an Achilles Number or not. 
 import java.io.*;
 class Power
 public static boolean isPerfectPower(int num)
 for(int i = 2; i <= num; i++)
{
 for(int j = 2; j <= num; j++)
 if(Math.pow(i, j) == num)
 return true; 
 }
 else if(Math.pow(i, j) > num)
 break; 
 }
 } 
 return false; 
 } 
 public static void main(String args[])throws IOException
{
 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 System.out.print("Enter the number: "); 
 int num = Integer.parseInt(br.readLine()); 
 boolean status = true; 
 if(!isPerfectPower(num))
 int n = num; 
 int pf = 2; 
 while(n != 1)
 if(n % pf == 0)
{
 int s = pf * pf;
 if(num % s != 0)
 status = false; 
 break;
 }
 n /= pf; 
 } 
 else
 pf++; 
 }
 } 
 else 
 status = false; 
 if(status)
 System.out.println(num + " is an Achilles Number."); 
 else 
 System.out.println(num + " is not an Achilles Number.");
 } 
}

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...