Java test and sample codes