title: Java arrays with different length multiplication
body: <p>Hello I am working on a project and have come up against an issue I just can't figure out.</p>
  
  <p>I have 3 arrays all double... hours[], rate[], prevHrs[]. i copied the hours and prevhrs to a new array called monthhours[], now I need to rearrange it so that the elements in the hours array are each separately put into the proper place. I need the first 3 elements of prevhrs then the first element from hours, then the 4,5,6 element of prevhrs and the 2nd element of hours and so on. Then after all that is done I need to take each element from this new monthHours array and multiply it by the elements in the rate array. basically rate[0] would multiply by mountHours[0][1][2][3] then rate[1] multiply by monthHours[4][5][6][7]</p>
  
  <p>if anyone can help it would be much appreciated.  This is what I have so far, and I have asked almighty google but haven't been able to find what im looking for.</p>
  
  <pre><code>String [] names = {"Barry", "Lindsey", "Arron", "Brent"};
      double [] hours = {40.0, 37.5, 39.5, 18.5};
      double [] rate = {15.67, 8.90, 8.90, 12.33};
      double [] prevHrs = {32.0, 40.0, 39.0, 28.5, 31.5, 38.0, 40.0, 24.0, 36.0, 40.0, 40.0, 22.5};
      double [] monthHours = new double[16];
      double mostHours;
      mostHours =FinalMethods.getHighest(hours);
      double pay[] = FinalMethods.calculatePay(hours, rate);
      double totalPay[] = FinalMethods.calculateMonthpay(monthHours, rate);
  
      System.out.printf("The employee who Worked the most hours is %s" + " With %.2f" + "hours\n",names[0], mostHours);
      System.out.println(" ");
      System.out.println("Name \tHours \tRate \tTotal");
      for(int i=0;i&lt;names.length;i++)
          System.out.printf(names[i] +"\t"+ hours[i] +"\t"+ rate[i] +"\t"+ pay[i]+"\n" );
  
  
      System.arraycopy(hours, 0, monthHours, 0, hours.length);
  System.arraycopy(prevHrs, 0, monthHours, hours.length, prevHrs.length);
  
      System.out.println(" ");
      System.out.println("Employee Monthly Pay");
      System.out.println(" ");
      System.out.println("Name \tTotal");
      for(int i=0;i&lt;names.length;i++)
          System.out.printf(names[i] +"\t"+ totalPay[i]+"\n" );
  
  
  } 
  
      // Calculate Pay
              public  static double[] calculatePay(double[] hours, double[] rate){
  
                  double[] pay = new double[hours.length];
                  for (int i = 0; i &lt; hours.length; i++) {
                          pay[i] = hours[i] * rate[i];
                  }
                  return pay;
              }
  // Calculate Monthly Pay 
      public static double[] calculateMonthpay(double[] monthHours, double[] rate){
  
          double[] totalPay = new double[monthHours.length];
          for(int i = 0; i &lt; monthHours.length; i++){
              totalPay[i] = monthHours[i] * rate[i] % rate[rate.length];
          }
              return totalPay;
  
  }    
  </code></pre>