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 2 of 2

Thread: help

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help

    Enkripsi file
    private void jButton1EnActionPerformed(java.awt.event.ActionEve nt evt) {
    // TODO add your handling code here:
    String temp = "", tampung2;
    int temp1 = 0,temp2 = 0,cipherascii = 0;
    byte[] m2 = new byte[arr.length];
    tampung2 = jTextFieldKunci.getText();
    if(tampung2.equals(""))
    { JOptionPane.showMessageDialog(this, "kunci taseh kosong", "information", JOptionPane.INFORMATION_MESSAGE);
    }
    else
    {
    for ( int i = 0; i < arr.length; i++ )
    { for ( int k = 0;k < tampung2.length();k++)
    { char b = tampung2.charAt(k);
    temp2 = (int) b;
    if(k==0)
    {
    char a = m2.charAt(i);/*error*/
    temp1 = (int) a;
    cipherascii = temp1 ^ temp2;
    }
    else
    { temp1 = cipherascii;
    cipherascii = temp1 ^ temp2;
    }
    System.out.println(""+temp1+"xor"+temp2+"="+cipher ascii);
    if(k==tampung2.length()-1)
    { String nol = "0000000";
    String biner = Integer.toBinaryString(cipherascii);
    String binerx;
    if(biner.length() < 8)
    { binerx = nol.substring(0, 8-biner.length()) + biner;
    }
    else binerx = biner;
    String cipbiner = binerx.substring(1,8) + binerx.substring(0,1);
    int cipascii = Integer.parseInt(cipbiner, 2);
    String aChar = new Character((char)cipascii).toString();
    temp = temp + aChar ;
    System.out.println(cipherascii+"="+binerx+" geser ke kiri 1 byte " + cipbiner);


    }

    }}}System.out.println(temp);
    }

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: help

    When posting code, please use the highlight tags to preserve formatting. also, please use a more descriptive title, otherwise most people will simply ignore your post.

    You haven't actually posted a problem or a question. What does this code do? What do you expect it to do? Does it compile? Does it throw an Exception? Something else?

    Finally, ditch the gui builder until you understand what it's doing under the hood.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!