The method you are looking for is not specific to Android, but to Java in general. You're looking for the MessageDigest (import java.security.MessageDigest
).
An implementation of a sha512(String s)
method can be seen here, and the change for a SHA-1 hash would be changing line 71 to:
MessageDigest md = MessageDigest.getInstance("SHA-1");