<gouthampradhan>array_MaximumSwap_1.java
public int maximumSwap(int num) {
    int[] D = new int[10];
    char[] A = String.valueOf(num).toCharArray();
    for (int i = 0; i < A.length; i++) {
      D[A[i] - '0'] = i;
    }
    boolean found = false;
    for (int i = 0; i < A.length; i++) {
      int digit = A[i] - '0';
      for (int j = 9; j > digit; j--) {
        if (D[j] > i) {
          char temp = A[i];
          A[i] = (char) (j + '0');
          A[D[j]] = temp;
          found = true;
          break;
        }
      }
      if (found) break;
    }
    return Integer.parseInt(String.valueOf(A));
  }
public int sample_funcname ( int var_0 ) {
  int [ ] var_2 = new int [ 10 ] ;
  char [ ] var_6 = String . valueOf ( var_0 ) . toCharArray ( ) ;
  for ( int var_8 = 0 ;
  var_8 < var_6 . length ;
  var_8 ++ ) {
    var_2 [ var_6 [ var_8 ] - '0' ] = var_8 ;
  }
  boolean var_16 = false ;
  for ( int var_8 = 0 ;
  var_8 < var_6 . length ;
  var_8 ++ ) {
    int var_12 = var_6 [ var_8 ] - '0' ;
    for ( int var_14 = 9 ;
    var_14 > var_12 ;
    var_14 -- ) {
      if ( var_2 [ var_14 ] > var_8 ) {
        char var_15 = var_6 [ var_8 ] ;
        var_6 [ var_8 ] = ( char ) ( var_14 + '0' ) ;
        var_6 [ var_2 [ var_14 ] ] = var_15 ;
        var_16 = true ;
        break ;
      }
    }
    if ( var_16 ) break ;
  }
  return Integer . parseInt ( String . valueOf ( var_6 ) ) ;
}
