aspose file tools*
The moose likes Java in General and the fly likes Finding the number is having pairs and also number is in sequence/consecutive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Finding the number is having pairs and also number is in sequence/consecutive" Watch "Finding the number is having pairs and also number is in sequence/consecutive" New topic
Author

Finding the number is having pairs and also number is in sequence/consecutive

sandeshas naik
Greenhorn

Joined: Jan 04, 2007
Posts: 2
Hi All,

Can anyone help me to write a program to find out the given number is having pairs and also number is in sequence?
example: 11223344 is having pair 11 22 33 44 and also number is in sequence.

Please help
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11479
    
  16

HELP you? of course - we love doing that.

but nobody here is going to do it FOR you.

so..show us what you've got. Where are you stuck? Ask specific questions and you will get specific feedback. Ask general questions, and you'll get general feedback.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
sandeshas naik
Greenhorn

Joined: Jan 04, 2007
Posts: 2


The above code will give the count for each number but it will fails when we try for 12332144 - (Its not a sequence). Please help.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39851
    
  28
I am afraid there is a piece of hardware which is obstructing your progress. It is black and long and thin and it runs from the back of your computer to the wall. Remove it.

Get a sheet of paper a pencil and an eraser (the latter should be large, because you will use it a lot ‍). Write down in words of one syllable how you intend to do your exercise. Then you will be able to see how to convert it to code.
Two things to remind yourself of:-
  • 1: You are not dealing with a number, but a String. You can prove you are not dealing with numbers by converting your input to hexadecimal, and it will not work.
  • 2: You can do arithmetic with chars. They are not letters, but numbers hidden behind characters.
  •  
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Finding the number is having pairs and also number is in sequence/consecutive