beginn to port from perl to java