<求立方根>

alt

<字符逆序输出>

alt

数字逆序输出<排除首字符为零>

alt

<任意进制转化$通过桟实现>

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
    Scanner input=new Scanner(System.in);
    arrystack stack=new arrystack(100010);
    int m= input.nextInt();
    int n= input.nextInt();
    int ans=0;
    int count=0;
    while(m>0)
    {
        ans=m%n;
        stack.push(ans);
        m=m/n;
        count++;
    }
    stack.show();
}
}
class arrystack{
public int []stack;
public int maxsize;
public int top=-1;
public arrystack(int maxsize)
{
    this.maxsize=maxsize;
    stack=new int[maxsize];
}
public boolean isfull(){   //判断桟是否为满桟
    return top==maxsize-1;
}
public boolean isempy(){   //判断桟是否为空
    return top==-1;
}
public void push(int value)  //入桟
{
    if(isfull())
    {
        System.out.println("桟已满");
    }
    else
    {
        top++;
        stack[top]=value;
    }
}
public int pop() {   //出桟
    int value = 0;
    if (isempy()) {
        System.out.println("桟为空");
    } else {
        value = stack[top];
        top--;
    }
    return value;
}
public void show(){
    if(isempy())
    {
        System.out.println("桟为空");
    }
    else{
        for(int i=top;i>0;i--)
        {
            System.out.print(stack[i]);
        }
    }
}
}

<输出>

alt