...

View Full Version : New at Java

Bighairjersey
07-22-2011, 06:30 PM
I have been trying to learn java coding from a book and have run into a coding question that I'm confused about. Can someone help?
I have a one dimensional array of positive integers. I'm trying to create another array with the same length and scan the original array for finding the maximum integer. I am then needing to copy that maximum integer in first position of the created array and set the maximum integer in the original array to zero. For second round, I need to write code to find the maximum integer in the original array and copy that in second position of created array and set the maximum integer in the original array to zero. I need to repeat this until all numbers in original array is zero. My created array should be sorted in positive integer numbers. I need to write this sort method that accepts a one dimensional array of integers that return the sorted array testing this method using the main method.

Philip M
07-22-2011, 06:44 PM
This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia!

bullant
07-23-2011, 03:16 AM
I have been trying to learn java coding from a book and have run into a coding question that I'm confused about. Can someone help?
I have a one dimensional array of positive integers. I'm trying to create another array with the same length and scan the original array for finding the maximum integer. I am then needing to copy that maximum integer in first position of the created array and set the maximum integer in the original array to zero. For second round, I need to write code to find the maximum integer in the original array and copy that in second position of created array and set the maximum integer in the original array to zero. I need to repeat this until all numbers in original array is zero. My created array should be sorted in positive integer numbers. I need to write this sort method that accepts a one dimensional array of integers that return the sorted array testing this method using the main method.

What you want to do can be done in both javascript and java. Although some of the syntax is similar for both, they are essentially different programming languages with java generally being much more powerful.

Do you want to do this with java or javascript since you posted in the javascript forum?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum