public static boolean isOutlier(int index,ArrayList<Double> values){
  if (values.size() <= 1) {
    return true;
  }
  if (index == 0) {
    return isRightOutlier(index,values);
  }
 else   if (index == values.size() - 1) {
    return isLeftOutlier(index,values);
  }
 else {
    return isRightOutlier(index,values) || isLeftOutlier(index,values);
  }
}

public static boolean isOutlier ( int index , ArrayList < Double > values ) { if ( values . size ( ) <= 1 ) { return true ; } if ( index == 0 ) { return isRightOutlier ( index , values ) ; } else if ( index == values . size ( ) - 1 ) { return isLeftOutlier ( index , values ) ; } else { return isRightOutlier ( index , values ) || isLeftOutlier ( index , values ) ; } }
this method looks at the data set and if there is a value that is 20 numbers higher than either the left , it is an outlier .
