Уже бесит эта задача, запускал раз 100 уже, но валидатору все не нравится второй пункт
package com.javarush.task.task14.task1420;
/*
НОД
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.Buffer;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader red = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(red.readLine());
int b = Integer.parseInt(red.readLine());
if (Math.abs(a) >= 0 && Math.abs(b) >= 0)
System.out.println(NOD( Math.abs(a), Math.abs(b)));
else throw new Exception();
}
static int NOD(int a, int b){
int tmp;
while(a!=0 && b!=0)
{
tmp = a%b;
a = b;
b = tmp;
}
return a;
}
}