<awangdev>852. Peak Index in a Mountain Array_1.java
public int peakIndexInMountainArray(int[] A) {
        int start = 1, end = A.length - 2;
        int mid = start + (end - start)/2;
        while (start + 1 < end) {
            mid = start + (end - start)/2;
            if (A[mid-1] < A[mid] && A[mid] > A[mid+1]) return mid;
            else if (A[mid-1] < A[mid+1]) start = mid;
            else if (A[mid-1] > A[mid+1]) end = mid;
        }
        return A[start] < A[end] ? end : start;
    }
public int sample_funcname ( int [ ] var_0 ) {
  int var_2 = 1 , var_5 = var_0 . length - 2 ;
  int var_6 = var_2 + ( var_5 - var_2 ) / 2 ;
  while ( var_2 + 1 < var_5 ) {
    var_6 = var_2 + ( var_5 - var_2 ) / 2 ;
    if ( var_0 [ var_6 - 1 ] < var_0 [ var_6 ] && var_0 [ var_6 ] > var_0 [ var_6 + 1 ] ) return var_6 ;
    else if ( var_0 [ var_6 - 1 ] < var_0 [ var_6 + 1 ] ) var_2 = var_6 ;
    else if ( var_0 [ var_6 - 1 ] > var_0 [ var_6 + 1 ] ) var_5 = var_6 ;
  }
  return var_0 [ var_2 ] < var_0 [ var_5 ] ? var_5 : var_2 ;
}
