⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fibonacciimpl.txt

📁 关于RMI的一个安全性人证的的问题
💻 TXT
字号:
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.math.BigInteger;

public class FibonacciImpl implements Fibonacci
{
   public FibonacciImpl() throws RemoteException 
   {
       UnicastRemoteObject.exportObject(this);
   }
  
   public BigInteger getFibonacci(int n) throws RemoteException 
   {
      return this.getFibonacci(new BigInteger(Long.toString(n)));
   }
   
   public BigInteger getFibonacci(BigInteger n)throws RemoteException
   {
      System.out.println("Calculating the "+n+"th Fibonacci number");
      BigInteger zero=new BigInteger("0");
      BigInteger one=new BigInteger("1");
      if(n.equals(zero))   return zero;
      if(n.equals(one))   return one;
      BigInteger i=one;
      BigInteger a=zero;
      BigInteger b=one;
      while(i.compareTo(n)==-1)
      {
         BigInteger temp=b;
         b=b.add(a);
         a=temp;
         i=i.add(one);
      }
      return b;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -