This is my code!这是我的代码!!
public class Solution {
    private static long[][]pows;

    public static long[] getNumbers(long N) {
        long[] result = null;
        ArrayList<Long> list = new ArrayList<>();
        long a;
        int length;
        int nlength = String.valueOf(N).length();
        String s;
        String[] strs;
       short b;
       getPows(nlength+1);
        for (long i = 1; i < N; i++) {
           a =0;
           s = String.valueOf(i);
           strs = s.split("");
           length = strs.length;
            for (int j = 0; j < strs.length; j++) {
                b = Short.parseShort(strs[j]);
                a+=pows[b][length];
            }
            if (i==a){list.add(i);}
        }
        Collections.sort(list);
        result = new long[list.size()];
        for (int i = 0; i < result.length; i++) {
            result[i] = list.get(i);
        }
        return result;
    }

    private static void getPows(int maxN){

        pows = new long[10][maxN];
        for (int i = 0; i < pows.length; i++) {
            long p =1;
            for (int j = 0;j<maxN;j++){
                pows[i][j] = p;
                p*=i;
            }
        }
    }

    public static void main(String[] args) {
        long a = System.currentTimeMillis();
        System.out.println(Arrays.toString(getNumbers(1000)));
        long b = System.currentTimeMillis();
        System.out.println("memory " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (8 * 1024));
        System.out.println("time = " + (b - a) / 1000);

        a = System.currentTimeMillis();
        System.out.println(Arrays.toString(getNumbers(1000000)));
        b = System.currentTimeMillis();
        System.out.println("memory " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (8 * 1024));
        System.out.println("time = " + (b - a) / 1000);
    }