Armstrong Number

Program to create a return type of method name Armstrong(int num) and return 1 if a number is an Armstrong else return 0 if a number is not an Armstrong. Call the method inside main() method.

Armstrong Number is a number whose sum of the power of digits is equal to the original number where power is number of digits in the number.

Example 1: 153. 13+53+33 = 1+125+27 = 153.

Example 2: 1634. 14+64+34+44 = 1+1296+81+256 = 1634.

Java
import java.util.*;
public class ArmstrongNumber
{
    public int Armstrong(int num)
    {
        int s=0,r=0,temp=0,count=0;
        temp=num;
        while(num>0)
        {
            count++;
            num=num/10;
        }
        num=temp;
        while (num>0)
        {
            r=num%10;
            s=s+(int)Math.pow(r,count);
            num=num/10;
        }
        if(temp==s) 
        {
            return 1;
        }
        else 
        {
            return 0;
        } 
    }
    public static void main(String args[])
    {
        int t=0,num=0;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter the number: ");
        num=sc.nextInt();
        ArmstrongNumber ob=new ArmstrongNumber();
        t=ob.Armstrong(num);
        System.out.println(t);
    }
}
Java