public static String randomName() {
Random random = new Random();
int f = random.nextInt(a1.length);
int f1 = random.nextInt(99);
int g = random.nextInt(a2.length);
int g1 = random.nextInt(99);
return a1[f] + "_" + a2[g] + g1;
}
/***
* BitSet of printable charwrite2Fileacters as defined in RFC 1521.
*/
private static final BitSet PRINTABLE_CHARS = new BitSet(256);
private static byte ESCAPE_CHAR = '=';
private static byte TAB = 9;
private static byte SPACE = 32;
// Static initializer for printable chars collection
static {
// alpha characters
for (int i = 33; i <= 60; i++) {
PRINTABLE_CHARS.set(i);
}
for (int i = 62; i <= 126; i++) {
PRINTABLE_CHARS.set(i);
}
PRINTABLE_CHARS.set(TAB);
PRINTABLE_CHARS.set(SPACE);
}
public static byte[] encodeQuotedPrintable(BitSet printable, byte[] bytes) {
if (bytes == null) {
return null;
}
if (printable == null) {
printable = PRINTABLE_CHARS;
}
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
for (int i = 0; i < bytes.length; i++) {
int b = bytes[i];
if (b < 0) {
b = 256 + b;
}
if (printable.get(b)) {
buffer.write(b);
} else {
encodeQuotedPrintable(b, buffer);
}
}
return buffer.toByteArray();
}
public static String randomNum() {
Random random = new Random();
int num = random.nextInt(1000000000 - 2);
int f = random.nextInt(9);
String str = String.format("1%d%09d", f, num);
return str;
}