[java] How to cast Object to boolean?