I think I need a break from coding at least for this task!
Please help!

package com.codegym.task.task20.task2025;
import java.util.Arrays;
import java.util.*;
/*
Number algorithms
*/
public class Solution {
public static long[] getNumbers(long N) {
if(N<=0) return new long[0];
try {
ArrayList<Long> result = new ArrayList<>();
for (long s=1; s < N ; s++) {
/* long x = s;
while (x!=0) { // get M
x=x/10;
++m;
} */
//seperate digits in the number s
String number = String.valueOf(s);
char[] digits = number.toCharArray();
int m = digits.length;
long sum = 0;
for (int i =0; i<digits.length; i++){
double d = Character.getNumericValue(digits[i]);
sum = sum + (long) Math.pow(d, m);
// if (sum>= s) break;
}
if (sum==s) {
result.add(s);
}
}
return result.stream().mapToLong(l -> l).toArray();
}
catch (NumberFormatException e) {
return new long[0];
}
}
public static void main(String[] args) {
getNumbers(376);
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);
}
}