Hutool 39

// With Hutool 3.9 – 6 lines
String csvData = HttpUtil.get("https://example.com/data.csv");
List<String> lines = StrUtil.split(csvData, '\n');
List<String> filtered = CollUtil.filter(lines, line -> line.contains("active"));
FileUtil.writeLines(filtered, "/tmp/filtered.csv", CharsetUtil.UTF_8);

Without Hutool?
~30 lines, 3 try-catch blocks, and a higher chance of a bug.

24. SecureUtil.md5(inputString) Returns MD5 hash as a hex string. Great for checksums.

25. SecureUtil.sha256(inputString) Safer hashing for passwords (though use SecureUtil.bcrypt for production).

26. SecureUtil.aes(key).encrypt(plainText) Symmetric encryption made dead simple.

27. DigestUtil.bcrypt(password) Industry-standard password hashing with auto-salt and work factor. hutool 39

Handling dates in Java is historically painful. Even with Java 8’s java.time API, many utility methods are missing. Hutool bridges the gap.

// Current time
Date date = DateUtil.date();

// String to Date (Smart parsing) String dateStr = "2023-10-15 12:30:00"; Date parsedDate = DateUtil.parse(dateStr);

// Date arithmetic Date tomorrow = DateUtil.offsetDay(date, 1); boolean isWeekend = DateUtil.isWeekend(date);

// Formatting String formatted = DateUtil.format(date, "yyyy/MM/dd"); // With Hutool 3

Yes, if:

No, if:

For new projects, consider Hutool 5.x (actively maintained). But for a solid, battle-tested utility library that just works, 3.9 remains a hidden gem. Without Hutool

// UUID (no dash)
String id = IdUtil.fastUUID();

// ObjectId (MongoDB style) String objectId = IdUtil.objectId();

From sending HTTP requests to generating MD5 hashes, these modules handle infrastructure-level tasks.

Now, let’s explore the 39 methods you’ll actually use every week.


<dependency>
    <groupId>cn.hutool</groupId>
    <artifactId>hutool-all</artifactId>
    <version>3.9.0</version>
</dependency>

int randInt = RandomUtil.randomInt(1, 100);
String uuid = RandomUtil.randomUUID();
String numbers = RandomUtil.randomNumbers(6);