public static final int lowNeighbour(int[] v, int x) {
      int max=-1, n=0;
      for(int i=0; i<v.length && i<x; i++) {
         if(v[i]>max && v[i]<v[x]) {
            max=v[i];
            n=i;
         }
      }
      return n;
   }