| |||||||||||||
Passing an array from a Mosel model to a Java method Description 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 PassArray.java
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
PassArray.java /** * 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; } } | |||||||||||||
© Copyright 2023 Fair Isaac Corporation. |