Java implementation complete