Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

shuffle characters in String

807603Jan 8 2008 — edited Jan 8 2008
Hy,I'll start with a program i'm dealing with.
I need to shuffle the characters in a String besides the first and last character in some text file for example.
Well i started like this
i put the word in some String
then i make char[] c = s.toCharArray();
then make a list.
List l = Arrays.asList(c);
Collections.shuffle(l);
Of course this doesn't work,i suppose because the list can't take char array,but in doc it is Object[]..My question is:if it is there anyway to shuffle the characters of a String with shuffle method in Collections?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2008
Added on Jan 8 2008
9 comments
2,146 views