Java tutorial
//package com.java2s; public class Main { /** * get nonce * @return */ public static String getNonce() { int random = (int) (Math.random() * 9000) + 1000; return String.valueOf(random); } }