Simple Java implementation of plot