Equivalent Java code