-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.java
More file actions
33 lines (31 loc) · 741 Bytes
/
Utils.java
File metadata and controls
33 lines (31 loc) · 741 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
public class Utils {
public static void clearScreen() {
try {
final String os = System.getProperty("os.name");
if (os.contains("Windows")) {
System.out.print("\033[H\033[2J");
System.out.flush();
} else {
System.out.print("\033[H\033[2J\033[3J");
System.out.flush();
}
} catch (final Exception e) {
System.out.println("Exception: " + e);
}
}
public static void sleep(int time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void flushInput() {
try {
while (System.in.available() > 0) {
System.in.read();
}
} catch (final Exception e) {
}
}
}