Ordenar manualmente uma matriz em ordem crescente

Tenho uma tarefa de casa para classificar uma matriz em ordem crescente. Obviamente, isso deve ser feito manualmente, sem usar nenhum tipo desort() função.

Eu imaginei fazer isso, eu precisaria de doisfor loops: o primeiro percorrerá a matriz existente e criará um valor temporário com o valor e o índice da matriz. O segundo loop compara os valores temporários aos valores existentes e os classifica. Continuo tentando escrever o código, mas não consigo entender direito. Aqui está o método mais recente que criei:

public int[] sortArray (int[] inArray)
{
    //Construct the array we're using here
    int[] newArray = inArray;

    for(int x = 0; x < a.length; x++) //a.length = # of indices in the array
    {
        int tempValue = a[x];
        int tempIndex = x;

        for(int y = 0; y < a.length; y++)
        {
            if(tempValue < a[y])
            {
                newArray[x] = tempValue;
            }
        }
    }

    return newArray;
}

Tenho certeza de que isso está incorreto, mas se alguém pudesse me empurrar na direção certa, seria muito apreciado!

questionAnswers(14)

yourAnswerToTheQuestion