[Impressum] [E-Mail]

package generated.javacard.copycardMoneySecure.copycard;

import javacard.framework.Util;

public class Arrays {

	public static boolean equals(boolean[] left, boolean[] right) {
		if (left.length != right.length)
			return false;
		for (short i = 0; i < left.length; i++)
			if (left[i] != right[i])
				return false;
		return true;
	}

	public static boolean equals(byte[] left, byte[] right) {
		if (left.length != right.length)
			return false;
		return (Util.arrayCompare(left, (short) 0, right, (short) 0,
				(short) left.length) == 0);
	}

	public static boolean equals(short[] left, short[] right) {
		if (left.length != right.length)
			return false;
		for (short i = 0; i < left.length; i++)
			if (left[i] != right[i])
				return false;
		return true;
	}

	public static boolean equals(Codeable[] left, Codeable[] right) {
		if (left.length != right.length)
			return false;
		for (short i = 0; i < left.length; i++) {
			if (!(left[i].equals(right[i])))
				return false;
		}
		return true;
	}

	public static void copy(byte[] from, byte[] to) {
		Util.arrayCopy(from, (short) 0, to, (short) 0, (short) from.length);
	}

	public static void copy(byte[] from, short offset, short length, byte[] to) {
		Util.arrayCopy(from, offset, to, (short) 0, (short) length);
	}

}