.. but still wrong :( Why?
package de.codegym.task.task14.task1420;
/*
GGT
*/
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));
try {
int val1 = Math.abs(Integer.parseInt(reader.readLine()));
int val2 = Math.abs(Integer.parseInt(reader.readLine()));
System.out.println(calcGGT(val1,val2));
}
catch( Exception e){
throw new RuntimeException();
}
}
public static int calcGGT(int a, int b){
if (a == 0)
return b;
while (b != 0) {
if (a > b)
a = a - b;
else
b = b - a;
}
return a;
}
}