Java port of CS2DS