Contact me sending an e-mail (antispam defense activated) |
Group up consecutive numbers in a listSandro Tosi, 10 September 2006
As output from a command (webMethods scheduler output), I recieve a list of number (in this case hours and minutes) that could be really long, let's say every hour from 5 AM to 9 PM is a 17 items list, that could be grouped up into 5..21 . The Java code provided does exactly this work: takes an int array as input and returns a StringBuffer with the sequential numbers grouped up as shown above. Here is the main code (highlighted with java2html), the full source code is available at this link:
Drop me an email, if you'd like to provide some comments. |