<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">public class Function {
	public static void main(String args[]) {
		//Series goes here.
		double series[] = {1,2,3};
		Function f = new Function(series);
	}
	
	public Function(double series[]) {
		double answer[] = new double[series.length];
		
		double sum = 0;
		
		//get the sum
		for(int i = 0; i &lt; series.length; i++) {
			sum += series[i];
		}
		
		//X[i] = 1 - (X[i] / (X1+X2+...+Xn))
		for(int i = 0; i &lt; series.length; i++) {
			answer[i] = 1 - (series[i] / sum);
		}
		
		//print list
		for(int i = 0; i &lt; answer.length; i++) {
			System.out.print(answer[i]);
			if((i+1) &lt; answer.length) { System.out.print(",");}
		}
		System.out.println();
	}
}
</pre></body></html>