类 StdArrayIO


  • public class StdArrayIO
    extends java.lang.Object
    Standard array IO. This class provides methods for reading in 1D and 2D arrays from standard input and printing out to standard output.

    For additional documentation, see Section 2.2 of Computer Science: An Interdisciplinary Approach by Robert Sedgewick and Kevin Wayne.

    • 方法概要

      修饰符和类型 方法 说明
      static void main​(java.lang.String[] args)
      Unit tests StdArrayIO.
      static void print​(boolean[] a)
      Prints a 1D array of booleans to standard output.
      static void print​(boolean[][] a)
      Prints a 2D array of booleans to standard output.
      static void print​(double[] a)
      Prints an array of doubles to standard output.
      static void print​(double[][] a)
      Prints the 2D array of doubles to standard output.
      static void print​(int[] a)
      Prints an array of integers to standard output.
      static void print​(int[][] a)
      Print a 2D array of integers to standard output.
      static boolean[] readBoolean1D()
      Reads a 1D array of booleans from standard input and returns it.
      static boolean[][] readBoolean2D()
      Reads a 2D array of booleans from standard input and returns it.
      static double[] readDouble1D()
      Reads a 1D array of doubles from standard input and returns it.
      static double[][] readDouble2D()
      Reads a 2D array of doubles from standard input and returns it.
      static int[] readInt1D()
      Reads a 1D array of integers from standard input and returns it.
      static int[][] readInt2D()
      Reads a 2D array of integers from standard input and returns it.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • readDouble1D

        public static double[] readDouble1D()
        Reads a 1D array of doubles from standard input and returns it.
        返回:
        the 1D array of doubles
      • print

        public static void print​(double[] a)
        Prints an array of doubles to standard output.
        参数:
        a - the 1D array of doubles
      • readDouble2D

        public static double[][] readDouble2D()
        Reads a 2D array of doubles from standard input and returns it.
        返回:
        the 2D array of doubles
      • print

        public static void print​(double[][] a)
        Prints the 2D array of doubles to standard output.
        参数:
        a - the 2D array of doubles
      • readInt1D

        public static int[] readInt1D()
        Reads a 1D array of integers from standard input and returns it.
        返回:
        the 1D array of integers
      • print

        public static void print​(int[] a)
        Prints an array of integers to standard output.
        参数:
        a - the 1D array of integers
      • readInt2D

        public static int[][] readInt2D()
        Reads a 2D array of integers from standard input and returns it.
        返回:
        the 2D array of integers
      • print

        public static void print​(int[][] a)
        Print a 2D array of integers to standard output.
        参数:
        a - the 2D array of integers
      • readBoolean1D

        public static boolean[] readBoolean1D()
        Reads a 1D array of booleans from standard input and returns it.
        返回:
        the 1D array of booleans
      • print

        public static void print​(boolean[] a)
        Prints a 1D array of booleans to standard output.
        参数:
        a - the 1D array of booleans
      • readBoolean2D

        public static boolean[][] readBoolean2D()
        Reads a 2D array of booleans from standard input and returns it.
        返回:
        the 2D array of booleans
      • print

        public static void print​(boolean[][] a)
        Prints a 2D array of booleans to standard output.
        参数:
        a - the 2D array of booleans
      • main

        public static void main​(java.lang.String[] args)
        Unit tests StdArrayIO.
        参数:
        args - the command-line arguments