Android Hex String Create makeInt(String hex)

Here you can find the source of makeInt(String hex)

Description

make Int

Declaration

public static int makeInt(String hex) 

Method Source Code

//package com.java2s;

public class Main {
    public static int makeInt(String hex) {
        int ret = 0;
        String[] hexChars = new String[16];
        for (int i = 0; i < 10; i++) {
            hexChars[i] = String.valueOf(i);
        }/*www  .j  av  a 2 s  .  c om*/
        hexChars[10] = "A";
        hexChars[11] = "B";
        hexChars[12] = "C";
        hexChars[13] = "D";
        hexChars[14] = "E";
        hexChars[15] = "F";
        int j;
        int k = 1;
        int l = hex.length() - 1;
        int m = hex.length() - 1;
        for (int i = 0; i < hex.length(); i++) {
            l = m - i;
            for (j = 0; j < hexChars.length; j++) {
                if (String.valueOf(hex.charAt(l)).equals(hexChars[j])) {
                    break;
                }
            }
            ret += k * j;
            k *= 16;
        }
        return ret;
    }
}

Related

  1. toHex(final int i)
  2. appendHexJavaScriptRepresentation(int codePoint, Appendable out)
  3. appendHexJavaScriptRepresentation(StringBuilder sb, char c)
  4. bytesToHexString(byte[] bArray)
  5. makeHex(int val)
  6. appendHexJavaScriptRepresentation(int codePoint, Appendable out)
  7. appendHexJavaScriptRepresentation(StringBuilder sb, char c)
  8. hexToBytes(CharSequence str)
  9. hexValue(char c)