数値をString型に変換したい。
ValueOf()
valueOf()を使うようだ。
0パディング
左を0で埋める方法。
http://stackoverflow.com/questions/473282/how-can-i-pad-an-integers-with-zeros-on-the-left
String.format("%05d", yournumber);
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
int value = 314;
String msg = String.format("%05d", value);
System.out.println(msg);
}
}
結果
00314
文字列連結演算子 +
@shiracamus さんのコメントにて「文字列連結演算子」を教えていただいた。
情報感謝。