public class shang
{
int[] a=new int[100];
int k=0;
public void fun(int i)
{
do
{
a[k]=i%16;
i=i/16;
k=k+1;
}
while(i!=0);
}
public static void main(String[] args)
{
shang sh=new shang();
sh.fun(16);
for(int j=sh.k-1;j>-1;j--)
System.out.print(""+sh.a[j]);
}
}
{
int[] a=new int[100];
int k=0;
public void fun(int i)
{
do
{
a[k]=i%16;
i=i/16;
k=k+1;
}
while(i!=0);
}
public static void main(String[] args)
{
shang sh=new shang();
sh.fun(16);
for(int j=sh.k-1;j>-1;j--)
System.out.print(""+sh.a[j]);
}
}
{
private int maxSize;
private int[] stackArray;
private int top;
public StackX(int s)
{
maxSize=s;
stackArray=new int[maxSize];
top=-1;
}
public void push(int j)
{
stackArray[++top]=j;
}
public int pop()
{
return stackArray[top--];
}
public boolean isEmpty()
{
return (top==-1);
}
public boolean isFull()
{
return (top == maxSize-1);
}
}
class QueueX
{
private StackX s1,s2;
private int maxSize;
QueueX(int s)
{
maxSize=s;
s1=new StackX(maxSize);
s2=new StackX(maxSize);
}
public void enqueue(int i)
{
if(!s1.isFull())
s1.push(i);
else if(!s2.isFull())
{
while(!s1.isEmpty()&&!s2.isFull())
s2.push(s1.pop());
s1.push(i);
}
else
System.out.println("队列已满");
}
public int dequeue()
{
if(s2.isEmpty())
{
while(!s1.isEmpty())
s2.push(s1.pop());
}
return s2.pop();
}
public boolean isEmpty()
{
return (s1.isEmpty()&&s2.isEmpty());
}
}
public class QueueApp
{
public static void main(String[] args)
{
QueueX q=new QueueX(5);
q.enqueue(1);
q.enqueue(2);
q.enqueue(3);
q.enqueue(4);
q.enqueue(5);
q.enqueue(6);
q.enqueue(7);
q.enqueue(8);
while(!q.isEmpty())
System.out.println(q.dequeue());
}
}
String hex = Integer.toHexString(num);
System.out.println(hex);
return hex;
}