public class StringUtils extends Object
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
bytesToHex(byte[] bytes)
Convert an array of arbitrary bytes into a String of hexadecimal number-pairs with each pair representing on byte
of the array.
|
static boolean |
isEmpty(String text)
Universal check on String-objects that even works on non-instantiated variables (null-references), as it checks for
null first.
|
static String |
md5Hash(String text)
Compute the MD-5 hash of a string, and return it has a string of hexadecimal numbers.
|
static String |
sha1Hash(String text)
Compute the SHA-1 hash of a string, and return it has a string of hexadecimal numbers.
|
public static boolean isEmpty(String text)
text
- The string-object to be checkedpublic static String bytesToHex(byte[] bytes)
bytes
- the array to convert into hexadecimal stringpublic static String sha1Hash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
text
- Text to compute the SHA-1 hash ofNoSuchAlgorithmException
- thrown if the SHA-1 algorithm cannot be foundUnsupportedEncodingException
- thrown if the encoding is not supportedpublic static String md5Hash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
text
- Text to compute the MD-5 hash ofNoSuchAlgorithmException
- thrown if the MD-5 algorithm cannot be foundUnsupportedEncodingException
- thrown if the encoding is not supportedCopyright © 2014. All Rights Reserved.