Results 1 to 2 of 2
  1. #1
    pavan528 is offline Member
    Join Date
    Sep 2012
    Rep Power

    Default Converting a Set into a Range Statement and Vice Versa.

    Hi all,
    I have a Set S=[1,2,3,4,5,10,12]

    Now I want to convert this Set into a Range Statement which is of Form as follows...

    Desired Range Statement Form is = 1..5\/10\/12.

    Since 1 to 5 are contigious in my Set, they are represented as 1..5 and 10 and 12 are single non contigious elements they are given a single element with a union (\/) Symbol.

    Similarly, I want to convert the RangeStatement 1..5\/10\/12 to Set S=[1,2,3,4,5,10,12].

    DO we have any efficient method to o this in Java?
    if I need to write my own method or is there any inbuilt method to do this.
    Last edited by pavan528; 04-14-2014 at 02:41 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Converting a Set into a Range Statement and Vice Versa.

    There isn't a built in method for that. You'll need to write your own method.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Converting strings to bits/bytes and vice versa
    By AlexGraal in forum New To Java
    Replies: 18
    Last Post: 02-23-2014, 11:28 PM
  2. Replies: 5
    Last Post: 04-16-2009, 06:30 PM
  3. converting image to binary code n vice versa
    By nupurashi in forum Advanced Java
    Replies: 4
    Last Post: 04-01-2009, 07:27 PM
  4. Postfix into prefix and vice versa
    By sfe23 in forum New To Java
    Replies: 9
    Last Post: 02-19-2009, 10:37 PM
  5. Converting to ASCII and vice-versa
    By pheonix in forum New To Java
    Replies: 2
    Last Post: 09-09-2008, 04:43 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts