Java Number Swap swap(String str, int i, int j)

Here you can find the source of swap(String str, int i, int j)

Description

swap

License

Apache License

Declaration

public static String swap(String str, int i, int j) 

Method Source Code

//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);
    }
}

Related

  1. swap(int elementWidth, long value)
  2. swap(Integer i, Integer j)
  3. swap(short myShort)
  4. swap(short value)
  5. swap(short x)
  6. swap(StringBuffer s, int i, int j)
  7. swap(T a, T b)
  8. swap(T... args)
  9. swap16(final int aValue)