[java] How to make a boolean variable switch between true and false every time a method is invoked?