C
C
Chvalov2017-05-10 02:54:16
Java
Chvalov, 2017-05-10 02:54:16

How to copy an array to an object (ArrayStoreException)?

public class Class1 implements Interface1 {
  public final Object[] Generator(int min, int max, int kol) {
    Object[] MasO = new Object[kol];
    double[] MasD = new double[kol];
    Random R = new Random();
       	 	for (int i = 0; i < kol; i++)
       	 	{
            		MasD[i] = R.nextDouble();
        	}
        	Arrays.sort(MasD);
    System.arraycopy(MasD, 0, MasO, 0, kol);
    // MasO = MasD.clone();
    return MasO;
  }

How to copy a double array into an object?
Wsu8xJb.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question