public int median(int[] a) {
		int temp;
		int asize = a.length;
		// sort the array in increasing order
		for (int i = 0; i < asize; i++)
			for (int j = i + 1; j < asize; j++)
				if (a[i] > a[j]) {
					temp = a[i];
					a[i] = a[j];
					a[j] = temp;
				}
		// if it's odd
		if (asize % 2 == 1)
			return a[asize / 2];
		else
			return ((a[asize / 2] + a[asize / 2 - 1]) / 2);
	}