How to change this php code to servlet?

Hi

How to change the folloiwing php code:

$random = rand();
$response = 'services/search/tmp/' . $random . '.gif';

to java servlet?


techquesAsked:
Who is Participating?
 
mahomeCommented:
This should fit:
You can choose MAX_RANDOM to your wishes

int MAX_RANDOM = 99999;
Double random = Math.floor(Math.random() *  MAX_RANDOM);
String response = "services/search/tmp/" + random.intValue() + ".gif";

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.