Here you can find the source of GenerateRandomPin()
public static int GenerateRandomPin()
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static int MaxPinLength = 4; public static int GenerateRandomPin() { int t = 0; Random random = new Random(); for (int i = 0; i < MaxPinLength - 1; i++) { t += random.nextInt(9);//w w w .jav a2s.com t *= 10; } return t; } }