Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

How to check StringArray is sorted or not?

 
Vass Lee
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator

Hi All,

I am new guy for JAVA. I want to check my String Array is sorted or not ? how can i achieve this ?.Any one give some sample ?



Here i want to check str is sorted or not ?.Values are stored in alphabetical ascending order or not ?

Thanks,
Vass Lee
 
Weng Keong Chan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sort the input array using Arrays.sort, then compare the resulted array with the input array, if they are the same, the input array is sorted..
 
Vass Lee
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator

Hi Weng Keong Chan,

Thakns for your response.

Can you provide any sample ?


Thanks,

Vass Lee
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please UseOneThreadPerQuestion
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Let's continue this in your other copy of this question.
 
    Bookmark Topic Watch Topic
  • New Topic