Update Main.java

added the code that determines the result image