reorganize code and test
add java code test: not passed yet