思路:
// @Title: 七进制数 (Base 7)
// @Author: qisiii
// @Date: 2022-03-07 10:18:02
// @Runtime: 1 ms
// @Memory: 39 MB
// @comment:
// @flag:
class Solution {
public String convertToBase7(int num) {
StringBuilder str=new StringBuilder();
List<Integer> result=new ArrayList();
while(Math.abs(num)>=7){
result.add(0,Math.abs(num%7));
num=num/7;
}
str.append(num);
for(int i:result){
str.append(i);
}
return str.toString();
}
}