org.bitbucket.openisoj.SignedAmount Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openisoj-core Show documentation
Show all versions of openisoj-core Show documentation
An extensible framework for creating ISO 8583 messages.
Ported from OpenIso.Net http://code.google.com/p/openiso8583net/
package org.bitbucket.openisoj;
public class SignedAmount {
private long value;
public SignedAmount(String packed) {
boolean negative = packed.charAt(0) == 'D';
value = Long.parseLong(packed.substring(1));
if (negative)
value = -value;
}
public SignedAmount(long value) {
this.value = value;
}
public long getValue() {
return value;
}
public String getSign() {
return value < 0 ? "D" : "C";
}
public String getPacked(int length) {
return getSign() + Utils.padLeft("" + Math.abs(value), length, '0');
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy