Test test = new Test();
Random r = new Random(100);
// Generating the same sequence numbers
for(int cnt=0;cnt<9;cnt++) {
System.out.print(r.nextInt() + " ");
}
System.out.println();
r = new Random(100);
for(int cnt=0;cnt<9;cnt++) {
System.out.print(r.nextInt() + " ");
}
System.out.println();
// Generating sequence of bytes
byte[] randArray = new byte[8];
r.nextBytes(randArray);
test.dumpArray(randArray);
}
void dumpArray(byte[] arr) {
for(int cnt=0;cnt< arr.length;cnt++) {
System.out.print(arr[cnt]);
}
System.out.println();
}
}
Пример 14.24.
Результатом будет:
-1193959466 -1139614796 837415749 -1220615319 -1429538713 118249332 -951589224 -1193959466 -1139614796 837415749 -1220615319 -1429538713 118249332 -951589224 81;-6;-107;77;118;17;93; -98;
Пример 14.25.
Локализация
Класс Locale