思路/想法:

代码实现:
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s1 = sc.next();
int b = sc.nextInt();
int[] arr1 = new int[s1.length()];
int j = 0;
for (int i = s1.length() - 1; i >= 0; i--) arr1[j++] = s1.charAt(i) - '0';
List<Integer> ans = multiply(arr1, b);
for (int i = ans.size() - 1; i >= 0; i--) {
System.out.print(ans.get(i));
}
}
public static List<Integer> multiply(int[] arr1, int b) {
List<Integer> ans = new ArrayList<>();
int t = 0;
for (int i = 0; i < arr1.length || t != 0; i++) {
if (i < arr1.length) t += arr1[i] * b;
ans.add(t % 10);
t /= 10;
}
while (ans.size() > 1 && ans.get(ans.size() - 1) == 0) ans.remove(ans.size() - 1);
return ans;
}
}