Android Open Source - android-orm-benchmark Util






From Project

Back to project page android-orm-benchmark.

License

The source code is released under:

Apache License

If you think the Android project android-orm-benchmark listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.littleinc.orm_benchmark.util;
/*from   w  w w  . j a v a  2s.  c  o m*/
import java.util.Random;
import java.util.concurrent.TimeUnit;

public class Util {

    private static final char[] FILENAME_CHARS = new char[62];

    private static final Random sRandom = new Random();

    static {
        for (int idx = 0; idx < 10; ++idx)
            FILENAME_CHARS[idx] = (char) ('0' + idx);
        for (int idx = 10; idx < 36; ++idx)
            FILENAME_CHARS[idx] = (char) ('a' + idx - 10);
        for (int idx = 36; idx < 62; ++idx)
            FILENAME_CHARS[idx] = (char) ('A' + idx - 36);
    }

    /**
     * Get a random String with the provided length, containing only characters
     * in {@link #FILENAME_CHARS}, e.g. "2pKfEz".
     */
    public static String getRandomString(int length) {
        char[] buf = new char[length];

        for (int idx = 0; idx < buf.length; ++idx) {
            buf[idx] = FILENAME_CHARS[sRandom.nextInt(FILENAME_CHARS.length)];
        }

        return new String(buf);
    }

    /**
     * @return millis
     */
    public static String formatElapsedTime(long nanos) {
        return String.valueOf(TimeUnit.NANOSECONDS.toMillis(nanos));
    }
}




Java Source Code List

com.littleinc.orm_benchmark.Application.java
com.littleinc.orm_benchmark.BenchmarkExecutable.java
com.littleinc.orm_benchmark.MainActivity.java
com.littleinc.orm_benchmark.greendao.DaoMaster.java
com.littleinc.orm_benchmark.greendao.DaoSession.java
com.littleinc.orm_benchmark.greendao.DataBaseHelper.java
com.littleinc.orm_benchmark.greendao.Generator.java
com.littleinc.orm_benchmark.greendao.GreenDaoExecutor.java
com.littleinc.orm_benchmark.greendao.MessageDao.java
com.littleinc.orm_benchmark.greendao.Message.java
com.littleinc.orm_benchmark.greendao.UserDao.java
com.littleinc.orm_benchmark.greendao.User.java
com.littleinc.orm_benchmark.ormlite.Contact.java
com.littleinc.orm_benchmark.ormlite.DataBaseHelper.java
com.littleinc.orm_benchmark.ormlite.Message.java
com.littleinc.orm_benchmark.ormlite.ORMLiteExecutor.java
com.littleinc.orm_benchmark.ormlite.User.java
com.littleinc.orm_benchmark.ormlite.config.DBConfigUtil.java
com.littleinc.orm_benchmark.sqlite.DataBaseHelper.java
com.littleinc.orm_benchmark.sqlite.Message.java
com.littleinc.orm_benchmark.sqlite.SQLiteExecutor.java
com.littleinc.orm_benchmark.sqlite.User.java
com.littleinc.orm_benchmark.util.Util.java