addingmachine.java

来自「< ProJavaProgrammingSecondEdition>」· Java 代码 · 共 22 行

JAVA
22
字号
public class AddingMachine {

  /**
   *  Adds two integers together and returns the result.
   */
  public static int addIntegers(int first, int second) {
    return addIntegers(new int[] {first, second});
  }

  /**
   *  Adds some number of integers together and returns the result.
   */
  public static int addIntegers(int[] values) {
    int result = 0;
    for (int i = 0; i < values.length; i++) {
      result += values[i];
    }
    return result;
  }

}

⌨️ 快捷键说明

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