### Question:
SHA2 { public String sha1hex(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException { byte[] bytesOfMessage = input.getBytes(); MessageDigest md = MessageDigest.getInstance("SHA-256"); byte[] thedigest = md.digest(bytesOfMessage); BigInteger bigInt = new BigInteger(1, thedigest); String hashtext = bigInt.toString(16); while (hashtext.length() < 32) { hashtext = "0" + hashtext; } return hashtext; }  String sha1hex(String input); static void main(String[] args);  }### Answer:
@Test public void testSha2() throws Exception { String src = "UliWarDa"; String sha2 = new SHA2().sha1hex(src); assertEquals("ea04b5f95c701e1764e8dca2f0ceefb3a7051c2cae5cdc24ff3dae3703137c8d", sha2); }