Android Byte Array to ASCII Convert getBCD4(byte[] b, int offset)

Here you can find the source of getBCD4(byte[] b, int offset)

Description

get BCD

Declaration

public static int getBCD4(byte[] b, int offset) 

Method Source Code

//package com.java2s;

public class Main {

    public static int getBCD4(byte[] b, int offset) {
        int ret = (b[offset + 3] & 0x0f);
        ret += ((b[offset + 3] >>> 4) & 0x0f) * 10;
        ret += (b[offset + 2] & 0x0f) * 100;
        ret += ((b[offset + 2] >>> 4) & 0x0f) * 1000;
        ret += (b[offset + 1] & 0x0f) * 10000;
        ret += ((b[offset + 1] >>> 4) & 0x0f) * 100000;
        ret += (b[offset] & 0x0f) * 1000000;
        ret += ((b[offset] >>> 4) & 0x0f) * 10000000;
        return ret;
    }/*from www.  jav a 2  s .co m*/
}

Related

  1. toAsciiBytes(byte[] raw)
  2. toAsciiChars(byte[] raw)
  3. Bcd2Ascii(byte[] bcd)
  4. getBCD2(byte[] b, int offset)
  5. bcdToAscii(byte[] bcdByte)
  6. bcdToAscii(byte[] bcdByte, int offset, int length)
  7. bcdToAscii(byte[] bcd_buf, int offset, byte[] ascii_buf, int asc_offset, int conv_len, int type)
  8. toAsciiString(byte[] data)