Results 1 to 14 of 14

Thread: Help my Java

  1. #1
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default Help my Java

    hi , i need help java eclipse.
    i have one exercise with scramlbe.
    i dont understand nothing this code???
    Please help me.

    write me if you can help me...


    Please help me!!!:(

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I think that we can help you, but first you will need to ask an answerable question. Please have a look at this site as it may help you formulate one: How To Ask Questions The Smart Way

    I know that the site has helped me.

    Also, since I doubt that this is truly an Eclipse question and is more likely a Java question, I'm going to move this question to the "New to Java" section.

    Much luck!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Oh, and by the way, let me be the first to welcome you to our forum!

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Private message from est7:
    Quote Originally Posted by est7 View Post
    Quote Originally Posted by est7
    Hi
    Sorry i am new member, i am from estonia, i dont speak very well english.

    Download scramble.txt - UPLOAD.EE
    i need make this exercise end, please help me:o
    est7: let's keep all the discussion in the forum please, not by private message.

    Also, you should post the code in here as text using code tags, for instance:

    Java Code:
    //http://en.wikipedia.org/wiki/Scrambler
    
    public class Scrambler {
    	private int register, pikkus, algseis, valjund;
    	public Scrambler(int p, int yhed[],int valj[] ){
    		register = 0;
    		pikkus = p;
    		algseis = 0;
    		for(int j=0; j<yhed.length; j++)
    			algseis = Binary2.setBit(algseis, yhed[j], 1);
    		register = algseis;
    		System.out.println("algseis\t"+Binary.intToBinary(algseis));
    		valjund = 0;
    		for(int j=0; j<valj.length; j++)
    			valjund = Binary2.setBit(valjund, valj[j], 1);
    		System.out.println("valjund\t"+Binary.intToBinary(valjund));
    	}	
    	public void reset(){ register = algseis; }
    	int scramb( int bit) {
    		/* 
    		 *   bithaaval korrutada register ja valjund
    		 *   leida 1 arv korrutises
    		 *   u = yhtede arv modulo 2
    		 *   nihutada registrit 1 järk paremale
    		 *   registri 0. bit = u
    		 *   return (bit+u) modulo 2 (või bit xor u)
    		 */
    		return 0 või 1
    	}
    	public static void main(String[] args) { 
    			int y[]={0,3,5,7};
    			int v[] = {13,14};
    			Scrambler s = new Scrambler(15,y,v);
    			/*   
    			 * luua massiiv int[], milles mingid bitid on 1
    			 * scrambleerida; 
    			 * reset()
    			 * deskrambleerida
    			 * tulemuseks peab olema esialgne massiiv
    			
    			 */
    	}
    
    }
    Since we most here speak Estonian, we're going to have language difficulties here with your code, sorry.

    Again, please read my link to help you formulate your question regarding this code. Best of luck.

  5. #5
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    Ok sorry , i cant put right version:S
    To be able to post links or images your post count must be 20 or greater. You currently have 1 posts.

    Please remove links from your message, then you will be able to submit your post.

  6. #6
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    here is right code, if you understand
    Java Code:
     
    public class Scrambler {
    	private int register, pikkus, algseis, valjund;
    	public Scrambler(int p, int yhed[],int valj[] ){
    		register = 0;
    		pikkus = p;
    		algseis = 0;
    		for(int j=0; j<yhed.length; j++)
    			algseis = Binary2.setBit(algseis, yhed[j], 1);
    		register = algseis;
    		System.out.println("algseis\t"+Binary.intToBinary(algseis));
    		valjund = 0;
    		for(int j=0; j<valj.length; j++)
    			valjund = Binary2.setBit(valjund, valj[j], 1);
    		System.out.println("valjund\t"+Binary.intToBinary(valjund));
    	}	
    	public void reset(){ register = algseis; }
    	int scramb( int bit) {
    		/* 
    		 *  bit multiply the register and output
    		 *   one  to find the number of multiplication
    		 *   u = yhtede arv modulo 2
    		 *   1 record gradually shifted to the right
    		 *   registri 0. bit = u
    		 *   return (bit+u) modulo 2 (or bit xor u)
    		 */
    		return 0 või 1
    	}
    	public static void main(String[] args) { 
    			int y[]={0,3,5,7};
    			int v[] = {13,14};
    			Scrambler s = new Scrambler(15,y,v);
    			/*   
    			 * to create an array int [], in which some form of bits of 1
    			 * scrambler
    			 * reset()
    			 * deskrambleerida
    			 * must result in an initial array
    			 */
    	}
    
    }
    Last edited by est7; 12-20-2009 at 08:53 AM.

  7. #7
    gcampton Guest

    Default

    you need to use the code tags instead of quote tags. [ code ] not [ quote ]

  8. #8
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    can anyone help me, please:(

  9. #9
    gcampton Guest

    Default

    As the variable names are not in english can you help by explaining what you are trying to do? What is the program supposed to do?

    you can use bullet-point English...
    like this example class of reading file to array / sorting.

    1. Open file and handle exceptions.
    2. While not end of file store current line in next array element.
    3. Sort array
    4. Output array to file, and handle exceptions...


    You said in your first post," I don't understand nothing this code. "
    Did you write this code or is this an example you are trying to decipher?
    Last edited by gcampton; 12-20-2009 at 01:54 PM.

  10. #10
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    i make this code school, teacher write and we write down this:S

    i need make java Scrambler where is number bit.
    Last edited by est7; 12-20-2009 at 02:36 PM.

  11. #11
    Char's Avatar
    Char is offline Member
    Join Date
    Dec 2009
    Posts
    41
    Rep Power
    0

    Default

    hey im also from estonia, what school do you go to?

    anyways..this code is too hard for me considered im a newbie in JAVA

    i think this code converts numbers from decimal to binary or something like that

  12. #12
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by Char View Post
    hey im also from estonia, what school do you go to?

    anyways..this code is too hard for me considered im a newbie in JAVA

    i think this code converts numbers from decimal to binary or something like that
    Ok, code says estonia:
    Java Code:
    public void reset(){ register = algseis; }
    	int scramb( int bit) {
    		/* 
    		 *   bithaaval korrutada register ja valjund
    		 *   leida 1 arv korrutises
    		 *   u = yhtede arv modulo 2
    		 *   nihutada registrit 1 järk paremale
    		 *   registri 0. bit = u
    		 *   return (bit+u) modulo 2 (või bit xor u)
    		 */
    		return 0 või 1
    	}
    	public static void main(String[] args) { 
    			int y[]={0,3,5,7};
    			int v[] = {13,14};
    			Scrambler s = new Scrambler(15,y,v);
    			/*   
    			 * luua massiiv int[], milles mingid bitid on 1
    			 * scrambleerida; 
    			 * reset()
    			 * deskrambleerida
    			 * tulemuseks peab olema esialgne massiiv
    			
    			 */
    	}
    
    }
    it so hard to me , to make this code end:S

  13. #13
    est7 is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    please help me:S i need end this project:)

  14. #14
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    5

    Default

    Heres an english version (google translate)

    Java Code:
    (public class Scrambler
    private int index, length, start position, the output;
    public Scrambler (int p, int yhed [], int Valj []) (
    index = 0;
    length = p;
    initial position = 0;
    for (int j = 0, j <yhed.length j + +)
    = Binary2.setBit starting position (start position, yhed [j], 1);
    index = start position;
    System.out.println ( "starting position \ t" + Binary.intToBinary (starting position));
    Output = 0;
    for (int j = 0, j <valj.length j + +)
    Output = Binary2.setBit (output, Valj [j], 1);
    System.out.println ( "Output \ t" + Binary.intToBinary (output));
    )
    public void reset () (index = start position;)
    scramb int (int bit) (
    / *
    * Multiply bit register and the output
    * One to find the number of multiplication
    * U = yhtede number of modulo 2
    * 1 record gradually shifted to the right
    * Register 0 bit = u
    * Return (bits + u) modulo 2 (or bit XOR u)
    * /
    return 0 or 1
    )
    public static void main (String [] args) (
    int y [] = (0,3,5,7);
    int v [] = (13.14);
    Scrambler s = new Scrambler (15, y, v);
    / *
    * To create an array int [], in which some form of bits of 1
    * Scrambler
    * Reset ()
    * Deskrambleerida
    * Must result in an initial array
    * /
    )
    
    )

Posting Permissions

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