Anybody plz help.
package com.codegym.task.task14.task1420;
/*
GCD
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(read.readLine());
int b = Integer.parseInt(read.readLine());
int gcd = 0;
if(a <= 0)
throw new IllegalArgumentException("Numbers cannot be negative");
if(b <= 0)
throw new IllegalArgumentException("Numbers cannot be negative");
for(int i = 1; i < a && i < b; i++){
if(a % i == 0 && b % i == 0)
gcd = i;
}
System.out.println(gcd);
}
}