-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserRequest.java
More file actions
33 lines (25 loc) · 750 Bytes
/
Copy pathUserRequest.java
File metadata and controls
33 lines (25 loc) · 750 Bytes
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
import java.io.Serializable;
import java.util.Random;
public class UserRequest implements Serializable {
private static final long serialVersionUID = 1L;
private String IP;
private int RequestSize;
public UserRequest() {
this.IP = generateRandomIP();
this.RequestSize = new Random().nextInt(100) + 1;
}
private String generateRandomIP() {
Random r = new Random();
return r.nextInt(256) + "." + r.nextInt(256) + "." + r.nextInt(256) + "." + r.nextInt(256);
}
public String getIP() {
return IP;
}
public int getRequestSize() {
return RequestSize;
}
@Override
public String toString() {
return "UserRequest [IP=" + IP + ", RequestSize=" + RequestSize + "]";
}
}