Class ZComp


  • public class ZComp
    extends java.lang.Object
    Utility class to convert byte arrays representing binary numbers to and from Java short and int.
    System Z, Z/Series, 360, 370 and 390 is a trademark of IBM Corporation
    Version:
    5
    Author:
    zdecimal [ at ] benjaminjwhite.name
    See Also:
    IBM.COM, Z Decimal for java project home page
    • Constructor Summary

      Constructors 
      Constructor Description
      ZComp()  
    • Method Summary

      Modifier and Type Method Description
      static int compIntValue​(byte[] ba)
      Convert byte array to int, unsigned numbers
      static short compShortValue​(byte[] ba)
      Converts byte array to short, unsigned numbers
      static byte[] intToBytes​(int i)
      Convert int to byte array 4 long
      static byte[] shortToBytes​(short s)
      Convert short to byte array 2 long
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZComp

        public ZComp()
    • Method Detail

      • compShortValue

        public static short compShortValue​(byte[] ba)
                                    throws FixedPointDivideException
        Converts byte array to short, unsigned numbers
        Parameters:
        ba - - byte array 2 long, COBOL PIC 9(1 to 4) USAGE IS COMPUTATIONAL
        Returns:
        short value
        Throws:
        FixedPointDivideException
      • compIntValue

        public static int compIntValue​(byte[] ba)
                                throws FixedPointDivideException
        Convert byte array to int, unsigned numbers
        Parameters:
        ba - - byte array 4 long, COBOL PIC 9(5 to 9) USAGE IS COMPUTATIONAL
        Returns:
        int value
        Throws:
        FixedPointDivideException
      • shortToBytes

        public static byte[] shortToBytes​(short s)
        Convert short to byte array 2 long
        Parameters:
        s - - short number
        Returns:
        byte array
      • intToBytes

        public static byte[] intToBytes​(int i)
        Convert int to byte array 4 long
        Parameters:
        i - - int
        Returns:
        byte array