Class StdArrayIO
- Object
-
- StdArrayIO
-
public class StdArrayIO extends Object
TheStdArrayIO
class provides static 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.
- Author:
- Robert Sedgewick, Kevin Wayne
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(String[] args)
Unit testsStdArrayIO
.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.
-
-
-
Method Detail
-
readDouble1D
public static double[] readDouble1D()
Reads a 1D array of doubles from standard input and returns it.- Returns:
- the 1D array of doubles
-
print
public static void print(double[] a)
Prints an array of doubles to standard output.- Parameters:
a
- the 1D array of doubles
-
readDouble2D
public static double[][] readDouble2D()
Reads a 2D array of doubles from standard input and returns it.- Returns:
- the 2D array of doubles
-
print
public static void print(double[][] a)
Prints the 2D array of doubles to standard output.- Parameters:
a
- the 2D array of doubles
-
readInt1D
public static int[] readInt1D()
Reads a 1D array of integers from standard input and returns it.- Returns:
- the 1D array of integers
-
print
public static void print(int[] a)
Prints an array of integers to standard output.- Parameters:
a
- the 1D array of integers
-
readInt2D
public static int[][] readInt2D()
Reads a 2D array of integers from standard input and returns it.- Returns:
- the 2D array of integers
-
print
public static void print(int[][] a)
Print a 2D array of integers to standard output.- Parameters:
a
- the 2D array of integers
-
readBoolean1D
public static boolean[] readBoolean1D()
Reads a 1D array of booleans from standard input and returns it.- Returns:
- the 1D array of booleans
-
print
public static void print(boolean[] a)
Prints a 1D array of booleans to standard output.- Parameters:
a
- the 1D array of booleans
-
readBoolean2D
public static boolean[][] readBoolean2D()
Reads a 2D array of booleans from standard input and returns it.- Returns:
- the 2D array of booleans
-
print
public static void print(boolean[][] a)
Prints a 2D array of booleans to standard output.- Parameters:
a
- the 2D array of booleans
-
main
public static void main(String[] args)
Unit testsStdArrayIO
.- Parameters:
args
- the command-line arguments
-
-