Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   How to do encryption for char using java? (https://www.askmehelpdesk.com/showthread.php?t=784477)

  • Feb 15, 2014, 03:52 AM
    Mimypooh
    How to do encryption for char using java?
    public String getEncryption(String text){
    String x = "";

    for(int i = 0; i < text.length(); i++){
    String sub = text.substring(i, i+1);
    System.out.println(i + " = " + sub);
    String en = encrypt_code[Integer.parseInt(sub)];
    System.out.println("Result:" + en);
    x = x.concat(en);
    }
    return x;
    }

    how do I convert this to charAt?
    I have this so far:

    public String getEncryption2(String text){
    String x = "";


    for(int I = 0; I < text.length(); I++){

    char ch = text.charAt(I);

  • All times are GMT -7. The time now is 12:08 PM.