common_helper/src/main/java/com/xiongyingqi/util/DynamicPassword.java
public byte[] generateKey(int length) {
        if (length <= 0) {
            throw new IllegalArgumentException("长度为：" + length + "， 指定的密钥长度错误！");
        }
        byte[] bts = new byte[length];

        Random random = new Random();
        for (int i = 0; i < length; i++) {
            bts[i] = (byte) random.nextInt(255);
        }
        return bts;
    }
public byte[] generateKey(int length) {
        if (length <= 0) {
            throw new IllegalArgumentException("长度为：" + length + "， 指定的密钥长度错误！");
        }
        byte[] bts = new byte[length];

        Random random = new Random();
        for (int i = 0; i < length; i++) {
            bts[i] = (byte) random.nextInt(255);
        }
        return bts;
    }
public byte [ ] generateKey ( int length ) { if ( length <= 0 ) { throw new IllegalArgumentException ( "长度为：" + lengt  "， 指定 密 长度错误！"); } byte [ ] bts = new byte [ length ] ; Random random = new Random ( ) ; for ( int i = 0 ; i < length ; i ++ ) { bts [ i ] = ( byte ) random . nextInt ( 255 ) ; } return bts ; }
随机生成指定长度字节数的密钥
<br>2014-2-11 下午9:10:17

@param length
@return byte[]
随机生成指定长度字节数的密钥 <br > 2014 - 2 - 11 下午9 : 10 : 17