Getting TLE for java program


#1

Getting TLE for the following java program.

public class Solution {
public String multiple(int A) {

    int number[] = new int[10000000];
    
    
    int r = 0;
    number[0] = 1;
    Integer num;
    
    
    int k = 0;
    
    while(true)
    {
        num = number[r];
        // System.out.println(num);
        r++;
        if(num%A==0)
        {
            return new Integer(num).toString();
        }
        else
        {
            num = num * 10;
            k++;
            number[k] = num;
            k++;
            number[k] = num + 1;
        }
        
    }
    
}

}

Can anyone say how to not get TLE