compare to java example