public class NumberStr {
public static void main(String[] args) {
int n = 4;
int k = 3;
String numStr = "1423";
List list = show(numStr);
int count = 0;
for (int i = 0; i < n; i++) {
for(int j = i; j < n; j++){
}
int cur = 0;
int m = 0;
for (int j = i; j < n; j++) {
cur = (cur * 10 + (Integer.parseInt(numStr.charAt(j)+"")));
m = cur % k;
if (m==0) {
count++;
}
}
}
System.out.println(count);
}
public static List show( String str){
List list= new ArrayList<>();
for(int i = 0; i < str.length(); i++){
for (int j = i+1; j<=str.length(); j++){
list.add(str.substring(i,j));
System.out.println(str.substring(i,j));
return list;
}
}
}
}