/**
* 任意进制转换
*
* @author luoqinglong
* @date 2014-3-13 上午8:56:53
* @since 1.0
**/
public class Generate {
/**
* 进制对应的各个字符
*/
char[] template = { 'F', 'E', 'A', 'B', 'V', 'D', 'T', 'P' };
int size = template.length;
/**
*
* Description:
*
* @param args
**/
public static void main(String[] args) {
Generate generate = new Generate();
System.out.println(generate.convent(986));
//System.out.println(Integer.toOctalString(986));
}
/**
* 十进制转换
*
* @param orgNum
* 原始数据
* @return
*
*/
public String convent(int orgNum) {
char[] buf = new char[32];
int charPos = 32;
do {
buf[--charPos] = template[orgNum % size];
orgNum /= size;
} while (orgNum != 0);
return new String(buf, charPos, (32 - charPos));
}
}