some more translation C to Java :P