added first attempt at java port