java:java
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| java:java [2022/07/26 07:22] – [Executor Interfaces] admin | java:java [2024/05/31 05:22] (current) – [Random in Java] admin | ||
|---|---|---|---|
| Line 401: | Line 401: | ||
| // so add 1 to make it inclusive | // so add 1 to make it inclusive | ||
| ThreadLocalRandom.current().nextInt(min, | ThreadLocalRandom.current().nextInt(min, | ||
| + | </ | ||
| + | ==== Md5 ==== | ||
| + | <code java> | ||
| + | import java.util.HashMap; | ||
| + | import java.security.MessageDigest; | ||
| + | public static String md5(String original) { | ||
| + | try{ | ||
| + | MessageDigest md = MessageDigest.getInstance(" | ||
| + | md.update(original.getBytes()); | ||
| + | byte[] digest = md.digest(); | ||
| + | StringBuffer sb = new StringBuffer(); | ||
| + | for (byte b : digest) { | ||
| + | sb.append(String.format(" | ||
| + | } | ||
| + | return sb.toString(); | ||
| + | }catch(Exception e){ | ||
| + | return ""; | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| ==== Java Reflection ==== | ==== Java Reflection ==== | ||
| Line 566: | Line 585: | ||
| {{: | {{: | ||
| refer: | refer: | ||
| - | * https:// | ||
| - | * http:// | ||
| * https:// | * https:// | ||
| * http:// | * http:// | ||
| + | * http:// | ||
| Thread pools address two different problems: | Thread pools address two different problems: | ||
| * They usually provide improved performance when **executing large numbers of asynchronous tasks**, due to reduced per-task invocation overhead | * They usually provide improved performance when **executing large numbers of asynchronous tasks**, due to reduced per-task invocation overhead | ||
java/java.1658820126.txt.gz · Last modified: (external edit)
