import java.lang.Math.*;

public class Main
{
    static int Total=0;
    
    public static int isDisarium(int num)
    {
        
        int digit;
        
        int numberDigits=0;
        String pos="";
        int position;
        
        while (num!=0)
        {
        
        pos=Integer.toString(num);  // this converts the number to a string
        System.out.println("this is length of num:" + pos.length());
        position = Integer.valueOf(pos.length());  
        
        digit = num%10;   
        System.out.println("This is digit:  " + digit + "\n");
        
       // System.out.println(numberDigits); // this is no good since it loses track of this variable
        
        num=num/10;  // this will drop off last digit
        
        Total = (int)Math.pow(digit,position) + isDisarium(num);
        
        
        }
       
        return Total;
    }


    
    
    
    public static void main(String[] args) {
        
        int num=75;
        
        System.out.println("Following number will be checked: " + num);
        
        String outcome = isDisarium(num)==num ? "True":"False";
        
        System.out.println("Number is isDisarium: " + outcome);
        
            }
}
