All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bitbucket.openisoj.SignedAmount Maven / Gradle / Ivy

Go to download

An extensible framework for creating ISO 8583 messages. Ported from OpenIso.Net http://code.google.com/p/openiso8583net/

There is a newer version: 1.1.4
Show newest version
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