private static boolean isRightOutlier(int index,ArrayList<Double> values){
  double currentValue=values.get(index);
  double valueToRight=values.get(index + 1);
  return Math.abs(currentValue - valueToRight) > 20;
}

private static boolean isRightOutlier ( int index , ArrayList < Double > values ) { double currentValue = values . get ( index ) ; double valueToRight = values . get ( index + 1 ) ; return Math . abs ( currentValue - valueToRight ) > 20 ; }
this is simply just a utility method for isoutlier
