Всем привет, что делаю не так?
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 first = Integer.parseInt(reader.readLine());
int second = Integer.parseInt(reader.readLine());
int result = 0;
reader.close();
if (first < 0 || second < 0) {
throw new Exception();
} else {
result = gcd(first, second);
}
System.out.println(result);
}
public static int gcd(int a, int b) {
if (b == 0)
return Math.abs(a);
return gcd(b, a % b);
}
}