No matter what I try, 2nd condition won`t pass.
Tried:
No try, catch blocks, with throws Exception in main, as well as throws IOException
With try, catch and IllegalArgument, as well as NumberFormat, and then rethrowing it in catch
Nothing works.
package com.codegym.task.task14.task1420;
/*
GCD
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
System.out.println(findGCD(a, b));
}
private static int findGCD(int a, int b) {
return BigInteger.valueOf(a).gcd(BigInteger.valueOf(b)).intValue();
}
}