Convex Functions In Java