2016-06-20 4 views
0

Ich habe drei Doppel-Arraylisten. Ich möchte mehrere Array 1 zu Array 2 und legen Sie es in das dritte Array.Double ArrayList Multiplikation

// ArrayList 1 
[0.0, 1.0, 0.0, 1.0] 

// ArrayList 2 
// Random number generated by random() 
[0.37668669271524147, 0.429455596516655, 0.7337191115424969, 0.29389239043901294, 0.7050413406305202] 

And My Code

for (int i = 0; i < plans.size(); i++) { 

    for (int j = 0; i < value.size(); j++) { 
     try { 
      plansval.add(plans.get(i) * value.get(j)); 
     } 
     catch (IndexOutOfBoundsException e) { 
      System.out.println("IndexOutOfBoundsException: " + e.getMessage()); 
     } 
    } 
} 

ich IndexOutofBoundsExceptions. Könnten Sie mir bitte helfen, dieses Problem zu lösen, danke.

Antwort

1

In Ihrem Code ist ein Tippfehler enthalten. Ändern Sie einfach

for (int j = 0; i < value.size(); j++) { 

zu

for (int j = 0; j < value.size(); j++) { 
+0

Dank. So einfache Dinge, dass ich es nicht gesehen habe. – AH2012