converting demo lineshape to java