AZS

com.a2zss.ISO8583
Class Dec4Bit

java.lang.Object
  extended by com.a2zss.ISO8583.Dec4Bit

public class Dec4Bit
extends java.lang.Object

This class can be used for packing integer values to 4 bit decimal numbers and 4bit decimal numbers back to integer values


Method Summary
static byte[] to4Bit(int n, int len)
          converts an integer value to 4bit decimals where each decimal is presented by half of the byte values 0000..1001 if the len the length in bytes desired if the lenth of integer n is odd then a extra half of bye with 0000 is prepended
static int toInt(byte[] b4bit, int len)
          converts an 4 bit packed decimals to an integer value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

to4Bit

public static final byte[] to4Bit(int n,
                                  int len)
converts an integer value to 4bit decimals where each decimal is presented by half of the byte values 0000..1001 if the len the length in bytes desired if the lenth of integer n is odd then a extra half of bye with 0000 is prepended

Parameters:
n - - the number value to pack
len - - the lengh of the returned value in bytes
Returns:
a 4 bit packed decimals

toInt

public static final int toInt(byte[] b4bit,
                              int len)
converts an 4 bit packed decimals to an integer value

Parameters:
b4bit - the 4 bit packed decimals 0000...1001
len - the length of 4bit data to be used as 4 bit data
Returns:
decoded value

AZS

Copyright © 2002-2010 AZS Services Ltd. All Rights Reserved.