fork(2) 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. Random rnd = new Random();
  13. Map<Integer,String> m = new HashMap<Integer,String>();
  14. for (int i = 0 ; i != 500000 ; i++) {
  15. String s = "";
  16. for (int j = 0; j != 8 ; j++) {
  17. s += (char)(rnd.nextInt(26)+'A');
  18. }
  19. Integer h = s.hashCode();
  20. if (m.containsKey(h)) {
  21. String old = m.get(h);
  22. if (!old.equals(s)) {
  23. System.out.println(m.get(h)+" - "+s + " - " + h);
  24. }
  25. }
  26. m.put(h, s);
  27. }
  28. }
  29. }
Success #stdin #stdout 1.89s 380416KB
stdin
Standard input is empty
stdout
KDAINWZE - ARZAFEKI - -281780875
VZYVPVTE - SMKHKRPJ - 458671960
FMZJXLGP - TTGGKYBH - -291360364
NRKYJNTX - MYEVCTXD - 492772346
OQEZGGRY - BWKDMNXG - 1177131454
SZGJPXYE - EJELTNME - -1001196642
KIIZEPRJ - XVOSQDPM - 105228210
TGHJCPIK - DNOGBOUJ - 1087146628
WOFDYGRV - EZJYAUTD - 468552808
BKLCDEOZ - KVWJWYFR - -855549524
KFAVGTYS - PTMMXIBD - 1505020823
ZQNGCNFU - NGDRGQVO - -886788694
MYEHHAIM - WOFQERQM - 479973292
KPMPPFLD - ZAONLPXD - 2128385974
TNASYLFZ - BYFIAZHH - -1481703085
DFCFTLWA - SJPGCRGQ - -2061855449
ZZWAQUWP - QJPXICHT - -1236644601
NEBKTYHB - WZCTRKPB - 1569842815
NDCKJAVQ - XWEXCKTJ - 710647760
NBIQGTJR - QTSAAWGQ - -887115055
GAZRUEPZ - HXBYWWCH - -601367252
QIXTFTVE - ODAKFFYK - -1898881775
BHUEIOND - FOJVUMNS - 1036574642
QSFCMGXX - ERQOZHZZ - -2144608007
XGOWLOKJ - HNVTKNWI - -318869575