Tabnine Logo
Arrays.deepToString
Code IndexAdd Tabnine to your IDE (free)

How to use
deepToString
method
in
java.util.Arrays

Best Java code snippets using java.util.Arrays.deepToString (Showing top 20 results out of 3,348)

Refine searchRefine arrow

  • PrintStream.println
origin: stackoverflow.com

 String[][] deepArray = new String[][] {{"John", "Mary"}, {"Alice", "Bob"}};
System.out.println(Arrays.toString(deepArray));
//output: [[Ljava.lang.String;@106d69c, [Ljava.lang.String;@52e922]
System.out.println(Arrays.deepToString(deepArray));
origin: stackoverflow.com

 String[][] x = new String[][] {
  new String[] { "foo", "bar" },
  new String[] { "bazz" }
};
Log.d("this is my deep array", "deep arr: " + Arrays.deepToString(x));
// or
System.out.println("deep arr: " + Arrays.deepToString(x));
// will output: [[foo, bar], [bazz]]
origin: stackoverflow.com

 int[][] array = new int[rows][columns];
System.out.println(Arrays.deepToString(array));
origin: stackoverflow.com

 String[][] aastr = {{"hello", "world"},{"Goodbye", "planet"}};
System.out.println(Arrays.deepToString(aastr));
origin: stackoverflow.com

 public static void main(String[] args) {
  int twoD[][] = new int[4][]; 
  twoD[0] = new int[1]; 
  twoD[1] = new int[2]; 
  twoD[2] = new int[3]; 
  twoD[3] = new int[4]; 

  System.out.println(Arrays.deepToString(twoD));

}
origin: stackoverflow.com

int[] nums = { 1, 2, 3 };
 System.out.println(nums);
 // [I@xxxxx
 System.out.println(Arrays.toString(nums));
 // [1, 2, 3]
 int[][] table = {
     { 1, },
     { 2, 3, },
     { 4, 5, 6, },
 };
 System.out.println(Arrays.toString(table));
 // [[I@xxxxx, [I@yyyyy, [I@zzzzz]
 System.out.println(Arrays.deepToString(table));
 // [[1], [2, 3], [4, 5, 6]]
origin: stackoverflow.com

 System.out.println(
  java.util.Arrays.toString(
    new int[][] {
      { 1 },
      { 2, 3 },
    }
  )
); // prints "[[I@187aeca, [I@e48e1b]"

System.out.println(
  java.util.Arrays.deepToString(
    new int[][] {
      { 1 },
      { 2, 3 },
    }
  )
); // prints "[[1], [2, 3]]"
origin: stackoverflow.com

 import java.util.*;

public class Test {

  public static void main(String args[]) {

    int[][] twoDim = { {1, 2}, {3, 7}, {8, 9}, {4, 2}, {5, 3} };

    Arrays.sort(twoDim, Comparator.comparing((int[] arr) -> arr[0])
                   .reversed());

    System.out.println(Arrays.deepToString(twoDim));
  }
}
origin: stackoverflow.com

String data = "1|apple,2|ball,3|cat";
 String[] rows = data.split(",");
 String[][] matrix = new String[rows.length][]; 
 int r = 0;
 for (String row : rows) {
   matrix[r++] = row.split("\\|");
 }
 System.out.println(matrix[1][1]);
 // prints "ball"
 System.out.println(Arrays.deepToString(matrix));
 // prints "[[1, apple], [2, ball], [3, cat]]"
origin: stackoverflow.com

Scanner sc = new Scanner(data).useDelimiter("[,|]");
 final int M = 3;
 final int N = 2;
 String[][] matrix = new String[M][N];
 for (int r = 0; r < M; r++) {
   for (int c = 0; c < N; c++) {
     matrix[r][c] = sc.next();
   }
 }
 System.out.println(Arrays.deepToString(matrix));
 // prints "[[1, apple], [2, ball], [3, cat]]"
origin: stackoverflow.com

 List<List<String>> ls2d = new ArrayList<List<String>>();
List<String> x = new ArrayList<String>();
x.add("Hello");
x.add("world!");
ls2d.add(x);

System.out.println(Arrays.deepToString(ls2d.toArray()));
origin: apache/hbase

@Override
public int run(String[] args) throws Exception {
 if (args.length < 5) {
  System.err.println(USAGE);
  return 1;
  LOG.info("Running Loop with args:" + Arrays.deepToString(args));
  for (int i = 0; i < numIterations; i++) {
   LOG.info("Starting iteration = " + i);
  System.err.println("Parsing loop arguments failed: " + e.getMessage());
  System.err.println(USAGE);
  return 1;
origin: apache/hbase

if (args.length < 5) {
 System.err
   .println("Usage: Loop <num iterations> " +
     "<num mappers> <num nodes per mapper> <output dir> " +
     "<num reducers> [<width> <wrap multiplier>]");
 return 1;
LOG.info("Running Loop with args:" + Arrays.deepToString(args));
origin: stackoverflow.com

BigInteger[][] bigIntegerMatrix = zeroMatrix(BigInteger.class, 3, 3);
 Integer[][] integerMatrix = zeroMatrix(Integer.class, 3, 3);
 Float[][] floatMatrix = zeroMatrix(Float.class, 3, 3);
 String[][] error = zeroMatrix(String.class, 3, 3); // <--- compile time error
 System.out.println(Arrays.deepToString(bigIntegerMatrix));
 System.out.println(Arrays.deepToString(integerMatrix));
 System.out.println(Arrays.deepToString(floatMatrix));
origin: h2oai/h2o-3

for (Model m : ms) {
 KMeansModel kmm = (KMeansModel) m;
 System.out.println(kmm._output._tot_withinss + " " + Arrays.deepToString(
   ArrayUtils.zip(grid.getHyperNames(), grid.getHyperValues(kmm._parms))));
 GridTestUtils.extractParams(usedModelParams, kmm._parms, hyperParamNames);
origin: stackoverflow.com

System.out.println(Arrays.deepToString(table).replaceAll("],", "]," + System.getProperty("line.separator")));
origin: stackoverflow.com

 List<int[]> listOfIntArrays = new ArrayList<int[]>();
listOfIntArrays.add(new int[] { 10, 20, 30 });
listOfIntArrays.add(new int[] { 11, 21, 31 });
listOfIntArrays.add(new int[] { 12, 22, 32 });

int[][] intMatrix = listOfIntArrays.toArray(new int[0][]);

System.out.println(Arrays.deepToString(intMatrix));
origin: stackoverflow.com

 public static void main(String[] args) {
  int[][] int2DArray = new int[][] { {11, 12}, { 21, 22}, {31, 32, 33} };
  String[][] str2DArray = new String[][]{ {"John", "Bravo"} , {"Mary", "Lee"}, {"Bob", "Johnson"} };

  //Prior to Java 8
  System.out.println(Arrays.deepToString(int2DArray));
  System.out.println(Arrays.deepToString(str2DArray));

  // In Java 8 we have lambda expressions
  Arrays.stream(int2DArray).flatMapToInt(x -> Arrays.stream(x)).forEach(System.out::println);
  Arrays.stream(str2DArray).flatMap(x -> Arrays.stream(x)).forEach(System.out::println);
}
origin: h2oai/h2o-3

for (Model m : ms) {
 DRFModel drf = (DRFModel) m;
 System.out.println(
   drf._output._scored_train[drf._output._ntrees]._mse + " " + Arrays.deepToString(
     ArrayUtils.zip(grid.getHyperNames(), grid.getHyperValues(drf._parms))));
 GridTestUtils.extractParams(usedModelParams, drf._parms, hyperParamNames);
origin: h2oai/h2o-3

for (Key<Model> mKey : mKeys) {
 GBMModel gbm = (GBMModel) mKey.get();
 System.out.println(gbm._output._scored_train[gbm._output._ntrees]._mse + " " +
           Arrays.deepToString(
             ArrayUtils
               .zip(grid.getHyperNames(), grid.getHyperValues(gbm._parms))));
java.utilArraysdeepToString

Javadoc

Creates a "deep" String representation of the Object[] passed, such that if the array contains other arrays, the String representation of those arrays is generated as well.

If any of the elements are primitive arrays, the generation is delegated to the other toString methods in this class. If any element contains a reference to the original array, then it will be represented as "[...]". If an element is an Object[], then its representation is generated by a recursive call to this method. All other elements are converted via the String#valueOf(Object) method.

Popular methods of Arrays

  • asList
    Returns a List of the objects in the specified array. The size of the List cannot be modified, i.e.
  • toString
    Returns a string representation of the contents of the specified array. The string representation co
  • equals
    Returns true if the two specified arrays of booleans areequal to one another. Two arrays are conside
  • sort
    Sorts the specified range of the array into ascending order. The range to be sorted extends from the
  • copyOf
    Copies the specified array, truncating or padding with false (if necessary) so the copy has the spec
  • fill
    Assigns the specified boolean value to each element of the specified array of booleans.
  • stream
  • hashCode
    Returns a hash code based on the contents of the specified array. For any two boolean arrays a and
  • copyOfRange
    Copies the specified range of the specified array into a new array. The initial index of the range (
  • binarySearch
    Searches the specified array of shorts for the specified value using the binary search algorithm. Th
  • deepEquals
    Returns true if the two specified arrays are deeply equal to one another. Unlike the #equals(Object[
  • deepHashCode
    Returns a hash code based on the "deep contents" of the specified array. If the array contains other
  • deepEquals,
  • deepHashCode,
  • setAll,
  • parallelSort,
  • parallelSetAll,
  • spliterator,
  • checkBinarySearchBounds,
  • checkOffsetAndCount,
  • checkStartAndEnd

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JButton (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now