1

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?

1 Answer 1

1

In the end of "catch" block add

th = new ArrayList(x); 

or

List<Object> res = Arrays.asList(x); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.