// loop between start and end points
for (int i=inStartIndex; i<= inEndIndex; i++)
{
DataPoint currPoint = getPoint(i);
latitudeDiff += (currPoint.getLatitude().getDouble() - firstLatitude);
longitudeDiff += (currPoint.getLongitude().getDouble() - firstLongitude);
// loop between start and end points
for (int i=inStartIndex; i<= inEndIndex; i++)
{
DataPoint currPoint = getPoint(i);
latitudeDiff += (currPoint.getLatitude().getDouble() - firstLatitude);
longitudeDiff += (currPoint.getLongitude().getDouble() - firstLongitude);