Area under curve using rectangles and trapezium (Java)