public static void sort(int ar[]) {
		int temp;
		System.out.print("Array Before Sorting :\t");
		for (int element : ar) {
			System.out.print(element + " ");
		}
		// logic for increasing order
		for (int i = 0; i < ar.length; i++) {
			for (int j = i; j < ar.length; j++) {
				if (ar[i] > ar[j]) {
					temp = ar[i];
					ar[i] = ar[j];
					ar[j] = temp;
				}
			}
		}
		// output for increasing order
		System.out.println("\nArray in increasing order:\t");
		for (int element : ar) {
			System.out.print(element + "  ");
		}
		System.out.println("\n");

		// logic for decreasing order
		for (int i = 0; i < ar.length; i++) {
			for (int j = i; j < ar.length; j++) {
				if (ar[i] < ar[j]) {
					temp = ar[i];
					ar[i] = ar[j];
					ar[j] = temp;
				}
			}
		}
		// output for decreasing order
		System.out.println("Array in decreasing order:\t");
		for (int element : ar) {
			System.out.print(element + "  ");
		}
		System.out.println("\n");
	}