Random r = new Random();
int i = r.nextInt(9000);
return i + 1000;
public static String erzeugePIN()
{
int pin = (int) (Math.random()*10000);
if (pin < 1) return "0000";
if (pin < 10) return "000"+pin;
if (pin < 100) return "00"+pin;
if (pin < 1000) return "0"+pin;
return ""+pin;
}