aspose file tools*
The moose likes Java in General and the fly likes  	 How to check StringArray is sorted or not? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

How to check StringArray is sorted or not?

Vass Lee
Greenhorn

Joined: Nov 16, 2011
Posts: 8

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

Joined: Dec 05, 2011
Posts: 1
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

Joined: Nov 16, 2011
Posts: 8

Hi Weng Keong Chan,

Thakns for your response.

Can you provide any sample ?


Thanks,

Vass Lee
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Please UseOneThreadPerQuestion
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

Let's continue this in your other copy of this question.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check StringArray is sorted or not?