• + 0 comments

    Hi I figure it out how to do this in a straigth foward way with some convertions

     public static int findDigits(int n) {
            
        // Write your code here
        String n2 = Integer.toString(n);
        ArrayList<Integer> nuevo = new ArrayList<>();
        int contador=0;
        
       for(char l: n2.toCharArray()){
           int x = Character.getNumericValue(l);
           nuevo.add(x);
       }
       
       for (int n3 : nuevo){
        
        if (n3 !=0 && n%n3 ==0)
            contador ++;
       }
        System.out.println(nuevo);
        return contador;
        }
    
    }