Skip to content

Instantly share code, notes, and snippets.

@vladholubiev
Created July 24, 2014 21:32
Show Gist options
  • Select an option

  • Save vladholubiev/b7b9862e2db534dd52b4 to your computer and use it in GitHub Desktop.

Select an option

Save vladholubiev/b7b9862e2db534dd52b4 to your computer and use it in GitHub Desktop.
PrintWriter pw = new PrintWriter("uids.txt", "UTF-8");
BigInteger i = new BigInteger("0");
String uidPrefix = "20";
String uid = "";
while (!uid.equals("219999999999999999999")) {
i = i.add(BigInteger.valueOf(1));
uid = uidPrefix;
if (String.valueOf(i).length() < 19) {
for (int a = 0; a < 19 - String.valueOf(i).length(); a++) {
uid += "0";
}
}
uid += i;
if (uid.equals("209999999999999999999")) {
i = BigInteger.valueOf(0);
uidPrefix = "21";
}
pw.println(uid);
}
pw.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment