title: Java program to jumble a string not working
body: <pre><code>// java program to jumble a string
  import java.util.*;
  public class jumble
  {
       public static void main()
       {
           Scanner s = new Scanner(System.in);
           String a ;
           System.out.println("Enter a word");
           a = s.nextLine();
           int length = a.length();
           Random r = new Random();
           String newstring = "" ;
  
           int array[] = new int[length];
           List l = Arrays.asList(array);
           int i = 1 ; 
           int arpos = 0 ; 
           while(i&lt;= length)
           {
               int random = r.nextInt(length);
               if(!(l.contains(random)))
               {
                   newstring = newstring + a.charAt(random) ;
                   array[arpos] = random ;
                   l = Arrays.asList(array);
                   arpos ++ ;
                   i++ ;
                  }
              }
              System.out.println(newstring); 
          }
      }
  </code></pre>