Update Main.java

Updated checkDatabase function.