Не могу понять почему не пропускает
package com.javarush.task.task14.task1420;
/*
НОД
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
if (a<=0||b<=0)
throw new Exception();
findNod(a,b);
}
public static void findNod(int a, int b){
int min = a < b ? a : b;
int max = a>b?a:b;
for (int i = min; i>0;i--){
if (max%min==0) {
System.out.println(min);
break;
}
else
min--;
}
}
}