Here you can find the source of swap(String str, int i, int j)
public static String swap(String str, int i, int j)
//package com.java2s; //License from project: Apache License public class Main { public static String swap(String str, int i, int j) { char[] chars = str.toCharArray(); char temp = chars[i]; chars[i] = chars[j];/*w w w. j a va 2s .c o m*/ chars[j] = temp; return String.valueOf(chars); } }