Android Hash Code Calculate getHexDigit(String s, int i)

Here you can find the source of getHexDigit(String s, int i)

Description

get Hex Digit

License

Open Source License

Declaration

private static int getHexDigit(String s, int i) 

Method Source Code

//package com.java2s;
/*// w  w  w  .  ja v  a 2 s  .c  om
 * Copyright 2004-2008 H2 Group. Multiple-Licensed under the H2 License, Version 1.0, and under the Eclipse Public License, Version 1.0 (http://h2database.com/html/license.html). Initial Developer: H2 Group
 */

public class Main {
    private static int getHexDigit(String s, int i) {
        char c = s.charAt(i);
        if (c >= '0' && c <= '9') {
            return c - '0';
        } else if (c >= 'a' && c <= 'f') {
            return c - 'a' + 0xa;
        } else if (c >= 'A' && c <= 'F') {
            return c - 'A' + 0xa;
        } else {
            throw new RuntimeException("Can't get hex digit from " + s
                    + " at " + i);
        }
    }
}

Related

  1. computeWeakHash(String string)
  2. getHash(String text)
  3. getHashCode(final Object... pObjects)
  4. getHashCode(final byte... pBytes)
  5. getHashStringFromId(String id)
  6. createHash(String title, String URL, String content)
  7. createHash(String toHash)
  8. hash(int aSeed, boolean aBoolean)
  9. hash(int aSeed, char aChar)