Results 1 to 2 of 2
- 03-31-2009, 05:31 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 1
- Rep Power
- 0
How to add an integer to a array element and the store that backinto an array.
Hello everyone i'm new to java and never had any computer programming before.
and i'm current doing a project for school and i have a few question on the coding of an array.
Here is part of my program.
so please help ty in advancePHP Code:int []counts = new int [maxHeads + 1]; for(int i = 0; i <counts.length; i++) counts[i] = counts[i] * (int)((maxLength/maxCount) + 0.5); /* This is what i wanted to do "Now multiply each value in the counts array by the MAX length we want for bars (maxLength) and divide by the largest value found (“maxCount”). Remember the limitations of multiplication and division for integer variables. You will need to cast the integers to float or double for the calculation and cast the result back to integer to [COLOR="Red"][B][U]update the value in each counts array element[/U][/B][/COLOR]. It is also a good idea to add 0.5 to the float or double value before casting it back to an integer. That causes the code to round-off the value during the conversion rather than truncate the value." */
- 03-31-2009, 06:40 AM #2
please be more specific. what is your problem? Do you not know how to add, subtract using java arrays?
please list them.i have a few question on the coding of an array.USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
Similar Threads
-
How do you store a random integer in an array?
By Unknown in forum New To JavaReplies: 6Last Post: 03-21-2010, 10:40 PM -
Passing integer array from javascript to java
By lavanyashastri in forum New To JavaReplies: 1Last Post: 02-21-2009, 06:02 AM -
adding list to an array element
By Preethi in forum New To JavaReplies: 5Last Post: 09-25-2008, 04:23 AM -
Unique element in an array
By revathi17 in forum New To JavaReplies: 2Last Post: 12-31-2007, 08:44 AM -
Max element in an Array
By mew in forum New To JavaReplies: 5Last Post: 12-03-2007, 05:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks