Card shuffler help

hello

im trying to create a card shuffler app

so i entered the cards into an array

but what im trying to do is to generate two random indexes and swap them

heres the code

import java.util.*;

class CardShuffle{

//FIELDS

// Create scanner class instant

privatestatic Scanner input =new Scanner(System.in);

privatestaticint swaps, index1, index2, temp;

//METHODS--

publicstaticvoid main (String[] args){

System.out.println("Input desired number of swaps.");

System.out.println("Integer between 1 and 1000 (inclusive)");

swaps = input.nextInt();

String cards[] ={"2-Hrt","3-Hrt","4-Hrt","5-Hrt","6-Hrt","7-Hrt","8-Hrt","9-Hrt","10-Hrt","Jack-Hrt","Queen-Hrt","King-Hrt","Ace-Hrt",

"2-Spd","3-Spd","4-Spd","5-Spd","6-Spd","7-Spd","8-Spd","9-Spd","10-Spd","Jack-Spd","Queen-Spd","King-Spd","Ace-Spd",

"2-Dmd","3-Dmd","4-Dmd","5-Dmd","6-Dmd","7-Dmd","8-Dmd","9-Dmd","10-Dmd","Jack-Dmd","Queen-Dmd","King-Dmd","Ace-Dmd",

"2-Clb","3-Clb","4-Clb","5-Clb","6-Clb","7-Clb","8-Clb","9-Clb","10-Clb","Jack-Clb","Queen-Clb","King-Clb","Ace-Clb"};

// Generate two random indexes to swap

index1 = (int) (Math.random()*52);;

index2 = (int) (Math.random()*52);;

cards[index1] = temp;

cards[index2] = cards[index1];

temp = cards[index2];

System.out.print(cards[index1]);

System.out.print(cards[index2]);

System.out.print(cards[temp]);

}

}

i know the last part of the code is wrong i just wanted to show what im trying to do

im trying to swap the places of the indexes i generated from the random number

for example if the random numbers were 1 and 2

the cards would be 2-Hrt and 3-Hrt

and i want to swap the places of these cards

[3946 byte] By [shooter468] at [2007-11-26 12:03:48]
# 1
Try it this way round:temp = cards[index1];cards[index1] = cards[index2];cards[index2] = temp;
pbrockway2 at 2007-7-7 12:29:24 > top of Java-index,Java Essentials,Java Programming...