forked from fineanmol/Hacktoberfest2026
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrand.java
More file actions
21 lines (16 loc) · 651 Bytes
/
Copy pathrand.java
File metadata and controls
21 lines (16 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
public class UniqueProjectCodeGenerator {
public static String generateUniqueCode() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
Random random = new Random();
int randomNum = random.nextInt(10000);
return "PROJ-" + timestamp + "-" + String.format("%04d", randomNum);
}
public static void main(String[] args) {
String uniqueCode = generateUniqueCode();
System.out.println("Unique Project Code: " + uniqueCode);
}
}