Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /** 
     * we can't store a password as a string, since in Java
     * strings are immutable, and thus we can't null out and
     * guarantee the password doesn't hang around after GC;
     * CharSequence doesn't have this problem, and that's what
     * an EditText returns; So, we go from CharSequence to
     * an array of bytes; We want a byte array anyway, for crypto.
     *
     */
    public static char[] fromCharSeqToChars(CharSequence seq) {
        char[] ret = new char[seq.length()];
        int i;

        for (i = 0; i < seq.length(); i++) {
            ret[i] = seq.charAt(i);
        }
        return ret;
    }
}