Here you can find the source of random4DigitNumber()
public static int random4DigitNumber()
//package com.java2s; //License from project: Apache License public class Main { public static int random4DigitNumber() { return (int) (Math.random() * 9000) + 1000; }//from w w w . j a v a 2 s. com }