Here you can find the source of median_of_3(int[] x, int x_ptr)
static int median_of_3(int[] x, int x_ptr)
//package com.java2s; public class Main { static int median_of_3(int[] x, int x_ptr) { int t0, t1, t2; if (x[x_ptr] > x[x_ptr + 1]) { t0 = x[x_ptr + 1];/*from ww w. j ava 2 s. c o m*/ t1 = x[x_ptr]; } else { t0 = x[x_ptr]; t1 = x[x_ptr + 1]; } t2 = x[x_ptr + 2]; if (t1 < t2) { return t1; } else if (t0 < t2) { return t2; } else { return t0; } } }