Results 1 to 2 of 2
  1. #1
    Tien is offline Member
    Join Date
    Oct 2011
    Posts
    5
    Rep Power
    0

    Default array multiplication with single double

    Is it possible in Java to multiply a array of doubles with one single double?

    double [] ones = new double [] {1.0,1.0,1.0,1.0};
    double [] testArray = 2.0*ones;

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,044
    Blog Entries
    7
    Rep Power
    23

    Default Re: array multiplication with single double

    Quote Originally Posted by Tien View Post
    Is it possible in Java to multiply a array of doubles with one single double?

    double [] ones = new double [] {1.0,1.0,1.0,1.0};
    double [] testArray = 2.0*ones;
    You have to do the multiplication element by element; this scenario screams for a loop ...

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. int array multiplication
    By sternhagenr in forum New To Java
    Replies: 10
    Last Post: 08-20-2011, 01:41 AM
  2. I need fast multiplication of array???
    By lulzim in forum Advanced Java
    Replies: 1
    Last Post: 04-05-2011, 05:30 AM
  3. Genrate Single LL from Double LL
    By SHE in forum New To Java
    Replies: 4
    Last Post: 03-26-2011, 09:18 AM
  4. How do I modify the value of a single element in an array?
    By OriginalKopy in forum New To Java
    Replies: 1
    Last Post: 02-14-2011, 07:47 PM
  5. array to single char
    By rfviki in forum New To Java
    Replies: 5
    Last Post: 11-04-2010, 03:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •