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) {
  11. calculateHashCode("asdf","asdf","asdf");
  12. }
  13.  
  14. public static int calculateHashCode(String a, String b, String c) {
  15. final int prime = 31;
  16. long result = 1;
  17.  
  18. result = prime * result + ((a == null) ? 0 : a.hashCode());
  19. System.out.println(result);
  20. result = prime * result + ((b == null) ? 0 : b.hashCode());
  21. System.out.println(result);
  22. result = prime * result + ((c == null) ? 0 : c.hashCode());
  23. System.out.println(result);
  24.  
  25. System.out.println(a.hashCode());
  26. System.out.println(b.hashCode());
  27. System.out.println(c.hashCode());
  28. return (int) result;
  29. }
  30. }
Success #stdin #stdout 0.07s 2184192KB
stdin
Standard input is empty
stdout
3003475
96111169
2982449683
3003444
3003444
3003444