Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

To get the value from the Sorted Array  RSS feed

 
kalpana Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a very basic question I have an array and I sorted the values using
Arrays.sort method. But I am not able to figure out as to how to retrieve the individual sorted values?
Example:
static int[] test1={3,10,1,2,19,0}
Arrays.sort(test1);
Say, if I have 2 arrays and I have to compare values individually then it be easier if I sort them. But how to compare the individual values.
Are there any samples regarding the same.

Any suggestion is appreciated.

Thanks
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Access the member of the array with the [] as such:



Remember, arrays are zero-indexed, meaning the first element is a position 0, not 1.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!