com.servingxml.util.record
Class PackedDecimal
java.lang.Object
com.servingxml.util.record.PackedDecimal
public class PackedDecimal
- extends java.lang.Object
Field Summary |
protected byte[] |
data
|
Constructor Summary |
PackedDecimal(byte[] data,
int digitCount,
int decimalPlaces)
Constructs a newly allocated PackedDecimal object
from a byte array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
data
protected byte[] data
PackedDecimal
public PackedDecimal(byte[] data,
int digitCount,
int decimalPlaces)
- Constructs a newly allocated
PackedDecimal
object
from a byte array.
- Parameters:
data
- byte array containing a COBOL packed decimal numberdigitCount
- the total number of digits in the packed decimal numberdecimalPlaces
- the number of places to the right of the implied decimal
digitCount
public int digitCount()
decimalPlaces
public int decimalPlaces()
getPackedData
public byte[] getPackedData()
calculatePackedSize
public static int calculatePackedSize(int digitCount)
parse
public static PackedDecimal parse(java.lang.String s,
int digitCount,
int decimalPlaces)
throws java.lang.NumberFormatException
- Returns a new
PackedDecimal
initialized to the value represented by the specified
String
- Parameters:
s
- the string to be parseddigitCount
- the total number of digits in the packed decimal numberdecimalPlaces
- the number of places to the right of the implied decimal
- Throws:
java.lang.NumberFormatException
toString
public java.lang.String toString()
- Returns a string representation of this packed decimal object
- Overrides:
toString
in class java.lang.Object
- Returns:
- a string representation of this packed decimal object