### Question:
StringUtil { public static String encryptSHA1(String data) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(ALG_SHA1); md.update(data.getBytes()); byte[] digest = md.digest(); StringBuffer buf = new StringBuffer(); for (byte b : digest) { buf.append((Character.forDigit((b & 0xF0) >> 4, 16))); buf.append((Character.forDigit((b & 0xF), 16))); } return buf.toString(); }  static final String substring(String line, String start, String end); static final String substringR(String line, String start, String end); static final String concat(Object ... value ); static final int toInt(String str, int defaultValue); static final float toFloat(String str, float defaultValue); static final boolean checkNotEmpty(String str); static final void padStringRight(StringBuilder buf, String str, int length); static final String bytesToHexString(byte[] bytes); static final byte[] hexStringToBytes(String hexString); static final String[] splitMachineId(String machineId); static final Locale parseLocale(String languageTag, Locale defaultLocale); static final boolean checkValidEmail(String emailAddress); static String encryptSHA1(String data); static String encryptMD5(String data);  }### Answer:
@Test public void testEncryptSHA1() throws Exception { final String password = "hello"; String passwordEncrypt = StringUtil.encryptSHA1(password); System.out.println(passwordEncrypt); assertEquals(StringUtil.encryptSHA1(password), passwordEncrypt); TestUtil.doPerform(new Runnable() { public void run() { try { StringUtil.encryptSHA1(password); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } }, "SHA1", 10000); }