fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. import java.io.*;
  8. import java.security.MessageDigest;
  9. import java.security.NoSuchAlgorithmException;
  10. public class Test {
  11.  
  12. public static void main(String args[]) throws NoSuchAlgorithmException{
  13. String input="hello world";
  14. MessageDigest mDigest = MessageDigest.getInstance("SHA256");
  15. byte[] result = mDigest.digest(input.getBytes());
  16. for (int i = 0; i < result.length; i++) {
  17. sb.append(Integer.toString((result[i] & 0xff) + 0x100, 16).substring(1));}
  18. System.out.println(sb.toString());
  19.  
  20.  
  21.  
  22.  
  23. String Str = new String("hello world");
  24. System.out.println("Hashcode for Str :" + Str.hashCode() );
  25. }}
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:10: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
stdout
Standard output is empty