Example usage for java.lang String format

List of usage examples for java.lang String format

Introduction

In this page you can find the example usage for java.lang String format.

Prototype

public static String format(String format, Object... args) 

Source Link

Document

Returns a formatted string using the specified format string and arguments.

Usage

From source file:Main.java

public static String ByteToHex(byte b) {
    return String.format("%02X", b);
}

From source file:Main.java

public static String byteToHex(byte b) {
    return String.format("%02x", b);
}

From source file:Main.java

public static String IntTo2Hex(int val) {
    return String.format("%02X", val);
}

From source file:Main.java

public static String addHttp(String str) {
    return String.format("http://%1$s", str);
}

From source file:Main.java

public static String precentFormat(float x) {
    return String.format(":%.02f", x) + "%";
}

From source file:Main.java

public static String intTo2Dec(int number) {
    return String.format("%02d", number);
}

From source file:Main.java

public static String byteToHexString(byte b) {
    return String.format("%02X", b);
}

From source file:Main.java

private static String formateNumber(int time) {
    return String.format("%02d", time);
}

From source file:Main.java

public static String keep2Point(double number) {
    return String.format("%.2f", number);
}

From source file:Main.java

public static String padRight(String s, int n) {
    return String.format("%1$-" + n + "s", s);
}