@@ -0,0 +1,1511 @@
+package practice.mathematics;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A%0Apublic class Armstrong %7B%0A    %0A    public static Map%3CInteger, Integer%3E getPowerMap(int power) %7B%0A        Map%3CInteger, Integer%3E powerMap = new HashMap%3C%3E();%0A        %0A        for (int i = 0; i %3C=9; i++) %7B%0A            int pow = (int) Math.pow(i, power);%0A            powerMap.put(i, pow);%0A        %7D%0A        %0A        return powerMap;%0A    %7D%0A%0A    public static List%3CInteger%3E getArmstrong(int num) %7B%0A        List%3CInteger%3E armstrongList = new ArrayList%3C%3E();%0A        Map%3CInteger, Integer%3E powerMap = getPowerMap(num);%0A        %0A        int start = (int) (1 * Math.pow(10, num - 1));%0A        int end = (int) (1 * Math.pow(10, num) - 1);%0A        %0A        System.out.println(%22start:%22 + start + %22, end:%22 +end);%0A        %0A        int n%5B%5D = new int%5Bnum%5D;%0A        %0A        for (int i = start; i %3C= end; i++) %7B%0A            int nn = i;%0A            for (int j = 0; j %3C n.length; j++) %7B%0A                n%5Bj%5D = nn %25 10;%0A                nn /= 10;%0A            %7D%0A            %0A            int sum = 0;%0A            for (int j = 0; j %3C n.length; j++) %7B%0A                sum += powerMap.get(n%5Bj%5D);%0A            %7D%0A            if (sum == i) %7B%0A                armstrongList.add(i);%0A            %7D%0A        %7D%0A        %0A        return armstrongList;%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A        List%3CInteger%3E armstrongLisg = getArmstrong(3);%0A        System.out.println(armstrongLisg.toString());%0A    %7D%0A%7D%0A

Add Armstrong