This example program is used to shuffle a particular string.

Java Code:
public class Shuffle{
    public static void main(String[] args){
	String cards="abbckdoeglieha";
	System.out.println("Input String = " + cards);
	cards=shuffle(cards);
	System.out.println("Shuffled String = " + cards);
    }

    static String shuffle(String cards){
	if (cards.length()<=1)
	    return cards;

	int split=cards.length()/2;

	String temp1=shuffle(cards.substring(0,split));
	String temp2=shuffle(cards.substring(split));

	if (Math.random() > 0.5) 
	    return temp1 + temp2;
	else 
	    return temp2 + temp1;
    }
}