-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.java
50 lines (37 loc) · 1000 Bytes
/
App.java
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
42
43
44
45
46
47
48
49
50
import com.ifsygn.util.array.ArrayUtil;
public class App {
public static void main(String[] args)
{
RandomNumbersGenerator rng = new RandomNumbersGenerator(10, 10, 21);
System.out.println(rng.toString());
int [] a = rng.getNumbers();
for (int i = 0; i < a.length; ++i)
a[i] *= 2;
System.out.println(rng.toString());
}
}
class RandomNumbersGenerator {
private int [] m_numbers;
public RandomNumbersGenerator(int n, int min, int max)
{
m_numbers = ArrayUtil.getRandomArray(n, min, max);
}
public int getNumber(int index)
{
return m_numbers[index];
}
public int [] getNumbers() //dizi referansı
{
return m_numbers;
}
public String toString()
{
String result = "[";
for (int val : m_numbers) {
if (result.length() != 1)
result += ", ";
result += val;
}
return result + "]";
}
}