public static double[] ranks(Comparable[] __array) throws Exception {
        int _MAX;
        double[] RET;
        int rank=1;
        int j;

        Arrays.sort(__array);
        _MAX = __array.length;
        RET = new double[_MAX];
        for (int i=0; i < _MAX; ) {
            for (j=i+1; j < _MAX; j++) {
                if (__array[i].compareTo(__array[j]) == 0) {
                    continue;
                } else {
                    break;
                }
            }
            for (int k=i; k < j;  k++) {
		/* Kamra - Change */
		// Giving Average Rank when players tie
		RET[k] = rank + ((double)(j-i-1))/2.0;
//                RET[k] = rank;
            }
            rank += j-i;
            i = j;
        }
        return RET;
    }