Java Program to Calculate Power of a Number

 

public class JavaEx {
    public static void main(String[] args) {
    	
        int number = 5, p = 5;
        long result = 1;
        
        int i = p;
        for (;i != 0; --i)
        {
            result *= number;
        }
        
        System.out.println(number+"^"+p+" = "+result);
    }
}