Csg Java implementation