fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. Calendar cal = Calendar.getInstance();
  14. long lngUnique = 0l;
  15. String strUnique = "";
  16.  
  17. lngUnique = cal.getTimeInMillis();
  18. strUnique = String.valueOf(lngUnique);
  19.  
  20. System.out.println("ミリ秒取得値:" + strUnique);
  21. System.out.println("ハッシュコード:" + strUnique.hashCode());
  22.  
  23. System.out.println("ハッシュコード(2回目):" + strUnique.hashCode());
  24. }
  25. }
Success #stdin #stdout 0.06s 2184192KB
stdin
Standard input is empty
stdout
ミリ秒取得値:1556069796518
ハッシュコード:2019619222
ハッシュコード(2回目):2019619222