Example usage for java.lang Long toString

List of usage examples for java.lang Long toString

Introduction

In this page you can find the example usage for java.lang Long toString.

Prototype

public static String toString(long i, int radix) 

Source Link

Document

Returns a string representation of the first argument in the radix specified by the second argument.

Usage

From source file:Main.java

protected static String transformSerial(CharSequence n, int srcBase, int dstBase, int p1Width, int p1Padding,
        int p2Padding) {
    String p1 = lPad(Long.toString(Long.parseLong(n.toString().substring(0, p1Width), srcBase), dstBase),
            p1Padding, "0");
    String p2 = lPad(Long.toString(Long.parseLong(n.toString().substring(p1Width), srcBase), dstBase),
            p2Padding, "0");

    String c = p1 + p2;/*from   w  w  w.  j a v a  2 s  . c om*/
    return c.toUpperCase();
}

From source file:Main.java

/**
 * Returns a unique ID which can be used for example as the value of an
 * attribute of type ID.//from  w ww .  j  a  v  a  2s.  c o  m
 */
public static final String getUniqueId() {
    StringBuffer buffer = new StringBuffer();

    buffer.append("___");
    buffer.append(Long.toString(System.currentTimeMillis(), Character.MAX_RADIX));
    buffer.append(".");
    buffer.append(Integer.toString(uniqueId++, Character.MAX_RADIX));

    return buffer.toString();
}

From source file:com.dhenton9000.selenium.generic.UtilMethods.java

public static String generateRandomName(String rootName) {
    Random r = new Random();
    String randomStr = Long.toString(Math.abs(r.nextLong()), 21);
    String randomName = rootName + "_" + randomStr.substring(0, 4);
    return randomName;
}