Create a String variable, add the generated int value to it:
int randomPIN = (int)(Math.random()*9000)+1000; String val = ""+randomPIN;
OR even simpler
String val = ""+((int)(Math.random()*9000)+1000);
It could not be easier than that;)
Sharp edge
source share