Не пойму почему не проходит проверку по 2 пункту.
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 n1 = Integer.parseInt(reader.readLine());
int n2 = Integer.parseInt(reader.readLine());
if ((n1<0)||(n2<0)) {
throw new Exception();
}
System.out.println(nod(n1,n2));
}
public static int nod(int a,int b) {
while (b !=0) {
int tmp = a%b;
a = b;
b = tmp;
}
return a;
}
}