Locating the Largest Value in an ArrayList
source link: http://programmingbydoing.com/a/locating-the-largest-value-in-an-arraylist.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- Author: Graham Mitchell
- Filename: LocatingTheLargestValueInAnArraylist.java
Locating the Largest Value in an ArrayList
Write a program that creates an ArrayList of Integers. Fill the ArrayList with random numbers from 1 to 100. Display the values in the ArrayList on the screen. Then use a linear search to find the largest value in the ArrayList, and display that value and its slot number.
ArrayList: [45, 87, 39, 32, 93, 86, 12, 44, 75, 50] The largest value is 93, which is in slot 4
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK