FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Passing an array from a Mosel model to a Java method

Demonstrates constructing an array of reals in a Mosel model, then passing this to a Java method which returns the sum of the values, and finally displaying the returned sum from Mosel. You must compile the Java file before running the example - e.g. javac[download all files]

Source Files

 * Example Java class, containing a method that returns a value based on an array passed to it
 * @author  J.Farmer, (c) Fair Isaac Corporation, 2016
public class PassArray {
	public static double sumValues(double[] values) {
		double sum = 0;
		for (int i=0;i<values.length;i++) {
			sum += values[i];
		return sum;
Back to examples browserPrevious exampleNext example