Here you can find the source of swapAndPrint(int[] arr, int m, int n)
public static void swapAndPrint(int[] arr, int m, int n)
//package com.java2s; //License from project: Open Source License public class Main { public static void swapAndPrint(int[] arr, int m, int n) { int temp = arr[m]; arr[m] = arr[n];/* w w w . j a va2 s . com*/ arr[n] = temp; print(arr); } public static void print(int[] arr) { for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + " "); } System.out.println(""); } }