All pastes #279239 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-14 22:04 UTC
rendered paste body
public class Muutos {
	
	public static void main(String[] args) {
		int[] t = {1,2,3,-1,-2,-3,-3,2,2};
		annaMuutossuunnat(t);
	}

	public static int[] annaMuutossuunnat(int[] t) {
		int[] m = new int[t.length-1];
		for (int i = 0; i < m.length; i++) {
			if (t[i] > t[i+1])
				m[i] = -1;
			if (t[i] == t[i+1])
				m[i] = 0;
			if (t[i] < t[i+1])
				m[i] = 1;
		}
		return m;
	}
}