Guid.java
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.pdfg.common;
import java.security.SecureRandom;
import java.util.Random;
public class Guid {
static Random randomByteSource = new SecureRandom();
private final String guid;
public Guid() {
StringBuffer result = new StringBuffer();
this.appendRandomDigits(result);
for (int i = 0; i < 5; ++i) {
result.append('-');
this.appendRandomDigits(result);
}
this.guid = result.toString();
}
private void appendRandomDigits(StringBuffer result) {
int random = Guid.getRandomInt(16777216);
String randomDigits = Integer.toHexString(random);
for (int i = randomDigits.length(); i < 6; ++i) {
result.append('0');
}
result.append(randomDigits);
}
private static synchronized int getRandomInt(int bound) {
int random = randomByteSource.nextInt(bound);
return random;
}
public String toString() {
return this.guid;
}
}