Example usage for org.apache.wicket.util.crypt StringUtils newStringUsAscii

List of usage examples for org.apache.wicket.util.crypt StringUtils newStringUsAscii

Introduction

In this page you can find the example usage for org.apache.wicket.util.crypt StringUtils newStringUsAscii.

Prototype

public static String newStringUsAscii(final byte[] bytes) 

Source Link

Document

Constructs a new String by decoding the specified array of bytes using the US-ASCII charset.

Usage

From source file:sf.wicklet.ext.application.WickletSupport.java

License:Apache License

public static String randomString(final Random random, final int min, final int max) {
    final byte[] a = new byte[max];
    random.nextBytes(a);// ww w . ja v a  2  s.  c o m
    int len = min;
    if (max != min) {
        len += random.nextInt(max - min + 1);
    }
    String ret = StringUtils.newStringUsAscii(Base64.encodeBase64(a, false, true));
    if (ret.length() != len) {
        ret = ret.substring(0, len);
    }
    return ret;
}