Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: plz help me to do the program

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default plz help me to do the program

    hello..
    i need to calculate id=hash(number) xor id.id is string and number is random number.my problem is how to convert my string ex='hello' into equivalent integer,so that i can do xor.I have client and server program.i need to display a gui by using graphical nodes.
    Attached Files Attached Files


  2. #2
    Member
    Join Date
    Feb 2012
    Posts
    173
    Thanks
    6
    Thanked 10 Times in 10 Posts

    Default Re: plz help me to do the program

    Firstly use the [code*][/code] tags when posting code.

    Second, remember, a char is a number associated with a letter, if you convert the string to an array of chars, you can xor each letter using the ^ operator.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: plz help me to do the program

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

    Can you use String.hashCode()?

  4. #4
    Junior Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: plz help me to do the program

    Quote Originally Posted by GregBrannon View Post
    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

    Can you use String.hashCode()?


    hello sir,
    I need to develop the below lines...1)message1=Hash(ID) xor number
    2)Alias id=Hash(number) xor ID.

    I have calculated the hashcode of string(ID) and it works fine,but the second line is i am unable to perform the xor operation between number and string..so can u help me to write the code which reads the normal string like hello and display equivalent number so i can perform xor operation..

    --- Update ---

    Quote Originally Posted by GregBrannon View Post
    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

    Can you use String.hashCode()?


    hello sir,
    I need to develop the below lines...1)message1=Hash(ID) xor number
    2)Alias id=Hash(number) xor ID.

    I have calculated the hashcode of string(ID) and it works fine,but the second line is i am unable to perform the xor operation between number and string..so can u help me to write the code which reads the normal string like hello and display equivalent number so i can perform xor operation..

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: plz help me to do the program

    string like hello and display equivalent number
    Can you give some examples of the numbers that should be displayed for a String?
    Will each String have a unique number or are there possible collisions where two Strings can have the same number?
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: plz help me to do the program

    i am doing my academic project.
    for every string it has to generate equivalent unique number..
    for example vehicle 1 and vehicle 2.so the numbers must be unique with each other and again i want that string by using the numbers...

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: plz help me to do the program

    every string it has to generate equivalent unique number..
    Can you use the char value of the characters in the String to generate the number?
    I assume that there is no limit to the size of the number. For example int has 2 billion values which would not hold a large enough number. You'd have to use BigInteger variables to hold the values.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Java program. plz help?
    By java007 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 24th, 2013, 12:05 PM
  2. there is an exception in my program plz correct it.
    By nikita in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 15th, 2012, 04:42 AM
  3. plz help me in Bank program
    By Asom in forum Java Theory & Questions
    Replies: 1
    Last Post: February 14th, 2012, 08:17 PM
  4. Replies: 8
    Last Post: June 26th, 2011, 07:50 AM
  5. (URGENT) Plz help me with the black jack program.
    By diogo in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 4th, 2011, 04:08 AM