#336 test and Java implementation