java logics