我最近开始用Java编程,我编写了以下代码:
https://github.com/mouuff/JavaMD5cracker
代码可以正常工作,但我得到以下creppy警告:
C:\Users\mou\Desktop\JavaMD5cracker-master>javac icrackmd5.java
Note: .\brute.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
听起来像编译器发现此行(brute.java:l 26)不安全或我不知道...
if (tries > (int)pows.get(lenght-1))
有人可以帮我吗?
最佳答案
这是因为您在brute.java中声明了哈希表
Hashtable pows = new Hashtable();
编译器执行此行时
if (tries > (int)pows.get(lenght-1))
它不知道从战利品元素的类型是什么。
使用泛型更改您的哈希表声明
Hashtable<Integer, Integer> pows = new Hashtable<Integer,Integer>();