how to find highest common factor in java