Android Int to Hex Convert readIntToHexString(byte[] buff, int pos)

Here you can find the source of readIntToHexString(byte[] buff, int pos)

Description

read Int To Hex String

License

Open Source License

Declaration

public static String readIntToHexString(byte[] buff, int pos) 

Method Source Code

//package com.java2s;
/*/* www  .j ava2  s.  c o  m*/
 * 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 {
    public static String readIntToHexString(byte[] buff, int pos) {
        return Integer.toHexString(readInt(buff, pos));
        //    StringBuilder sb = new StringBuilder();
        //    String hex = Integer.toHexString(readInt(buff, pos));
        //    for (int i = 0; i < hex.length(); i += 2)
        //      sb.insert(0, hex.substring(i, i + 2));
        //    return sb.toString();
    }

    public static int readInt(byte[] buff, int pos) {
        return (buff[pos++] << 24) + ((buff[pos++] & 0xff) << 16)
                + ((buff[pos++] & 0xff) << 8) + (buff[pos] & 0xff);
    }
}