I'm doing sampling from log-normal distribution in Java using Matlab code (with javabuilder java).
Here is the code :
import demo2.*;
import com.mathworks.toolbox.javabuilder.*;
import java.util.*;
public class ht {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Object[] x = null; //?? What does Object[] mean?//
ArrayList th = new ArrayList();
demo y = null;
try {
y = new demo(); //the class created by Matlab builder ja//
x=y.lognorma(1, 10); //function to sample the distribution//
} catch (MWException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
What does Object[] mean in this context and how to change Object[] x into normal ArrayList in Java?
In the end of "catch" block add
th = new ArrayList(x);
or
List<Object> res = Arrays.asList(x);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.