fibonacciconstants.java

来自「随书的代码」· Java 代码 · 共 32 行

JAVA
32
字号
import java.math.BigInteger;public class FibonacciConstants {  public final static String rootElementName    = "Fibonacci_Numbers";  public final static String fibonacciElementName = "fibonacci";  public final static String xmlDeclaration    = "<?xml version=\"1.0\"?>";  public static void main(String[] args) {         BigInteger low  = BigInteger.ONE;      BigInteger high = BigInteger.ONE;                  System.out.println(xmlDeclaration);        System.out.println("<" + rootElementName + ">");        for (int i = 0; i < 10; i++) {        System.out.print("  <" + fibonacciElementName +">");        System.out.print(low);        System.out.println("</" + fibonacciElementName +">");        BigInteger temp = high;        high = high.add(low);        low = temp;      }      System.out.println("</" + rootElementName + ">");    }}

⌨️ 快捷键说明

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