Luzhanqi implementation in Java