Check out example codes for "ordenar numeros java". It will help you in understanding the concepts better.

Code Example 1

int[] numeros;
		numeros = new int[3];
		int con1 = 0, con2 = 0, num;
		Scanner sc;
		sc = new Scanner(System.in);

		for (int i = 0; i < numeros.length; i++) {
			System.out.println("Introduce 3 numeros:");
			num = sc.nextInt();
			numeros[i] = num;
		}
		System.out.println();
		System.out.println("estos son tus numeros: ");
		for (int i = 0; i < numeros.length; i++) {
			System.out.print(numeros[i] + " ");
		}
		
		for (int i = 0; i < numeros.length; i++) {
			
			for (int j = 0; j < numeros.length - i - 1; j++) {
				con1++;
				if (numeros[j] > numeros[j + 1]) {
					con2++;
					int aux;
					aux = numeros[j];
					numeros[j] = numeros[j + 1];
					numeros[j + 1] = aux;
					
				}

			}
		}
		System.out.println();
		System.out.println("ordenados: ");
		for (int i = 0; i < numeros.length; i++) {
			System.out.print(numeros[i] + " ");
		}

Learn ReactJs, React Native from akashmittal.com