/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] numeros = { 1, 5, 3, 25, 12, 6, 7, 2, 87, 44, 31, 0, -1, 4 };
        insertionSort(numeros);
        printVetor(numeros);
	}

	static void printVetor(int[] vetor) {// essa logica serve apenas para exibir meu vetor
        for (int i = 0; i < vetor.length; i++) {
            System.out.println(vetor[i]);
        }
    }

    static void insertionSort(int[] vetor) {
        int chave, valor;
        for (int i = 1; i < vetor.length; i++) {
            chave = i;
            valor = vetor[i];
            while (chave > 0 && valor < vetor[chave - 1]) {
                vetor[chave] = vetor[chave - 1];
                chave--;
            }
            vetor[chave] = valor;
        }
    }
}