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

How to use
toString
method
in
java.util.Arrays

Best Java code snippets using java.util.Arrays.toString (Showing top 20 results out of 52,632)

Refine searchRefine arrow

  • PrintStream.println
  • List.add
  • ArrayList.<init>
  • List.size
  • List.toArray
  • Arrays.sort
  • Scanner.<init>
  • List.get
origin: stackoverflow.com

 int[] intArray = { 7, 9, 5, 1, 3 };
System.out.println(Arrays.toString(intArray));
origin: stackoverflow.com

 List<String> list = Arrays.asList("foo", "bar", "waa");
CharSequence[] cs = list.toArray(new CharSequence[list.size()]);
System.out.println(Arrays.toString(cs)); // [foo, bar, waa]
origin: h2oai/h2o-2

private void sampleThresholds(int yi){
 _ti[yi] = (_newThresholds[yi].length >> 2);
 try{ Arrays.sort(_newThresholds[yi]);} catch(Throwable t){
  System.out.println("got AIOOB during sort?! ary = " + Arrays.toString(_newThresholds[yi]));
  return;
 } // sort throws AIOOB sometimes!
 for (int i = 0; i < _newThresholds.length; i += 4)
  _newThresholds[yi][i >> 2] = _newThresholds[yi][i];
}
@Override public void processRow(long gid, final double [] nums, final int ncats, final int [] cats, double [] responses /* time...*/){
origin: stackoverflow.com

 public static void main(String[] args) {
  final String str = "<tag>apple</tag><b>hello</b><tag>orange</tag><tag>pear</tag>";
  System.out.println(Arrays.toString(getTagValues(str).toArray())); // Prints [apple, orange, pear]
}

private static final Pattern TAG_REGEX = Pattern.compile("<tag>(.+?)</tag>");

private static List<String> getTagValues(final String str) {
  final List<String> tagValues = new ArrayList<String>();
  final Matcher matcher = TAG_REGEX.matcher(str);
  while (matcher.find()) {
    tagValues.add(matcher.group(1));
  }
  return tagValues;
}
origin: stackoverflow.com

import java.util.*;
 //...
 List<int[]> rowList = new ArrayList<int[]>();
 rowList.add(new int[] { 1, 2, 3 });
 rowList.add(new int[] { 4, 5, 6 });
 rowList.add(new int[] { 7, 8 });
 for (int[] row : rowList) {
   System.out.println("Row = " + Arrays.toString(row));
 } // prints:
  // Row = [1, 2, 3]
  // Row = [4, 5, 6]
  // Row = [7, 8]
 System.out.println(rowList.get(1)[1]); // prints "5"
origin: netty/netty

/**
 * Loads the first available library in the collection with the specified
 * {@link ClassLoader}.
 *
 * @throws IllegalArgumentException
 *         if none of the given libraries load successfully.
 */
public static void loadFirstAvailable(ClassLoader loader, String... names) {
  List<Throwable> suppressed = new ArrayList<Throwable>();
  for (String name : names) {
    try {
      load(name, loader);
      return;
    } catch (Throwable t) {
      suppressed.add(t);
      logger.debug("Unable to load the library '{}', trying next name...", name, t);
    }
  }
  IllegalArgumentException iae =
      new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
  ThrowableUtil.addSuppressedAndClear(iae, suppressed);
  throw iae;
}
origin: org.testng/testng

   "Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual),
   message);
 actualCollection.add(a);
if (actualCollection.size() != 0) {
 failAssertNoEqual(
   "Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual),
   message);
origin: apache/kylin

@Test
public void testGet() throws Exception {
  int getNum = 3000;
  List<String[]> keys = Lists.newArrayList();
  for (int i = 0; i < getNum; i++) {
    String[] keyi = new String[] { "keyyyyy" + random.nextInt(sourceRowNum) };
    keys.add(keyi);
  }
  long start = System.currentTimeMillis();
  for (int i = 0; i < getNum; i++) {
    String[] row = lookupTable.getRow(new Array<>(keys.get(i)));
    if (row == null) {
      System.out.println("null value for key:" + Arrays.toString(keys.get(i)));
    }
  }
  long take = System.currentTimeMillis() - start;
  System.out.println("muliti get " + getNum + " rows, take " + take + " ms");
}
origin: apache/drill

 @Override
 public void visitArrayMemberValue(ArrayMemberValue node) {
  values.add(Arrays.toString(node.getValue()));
 }
});
origin: apache/drill

   out.print(indentString(indent));
   if (appendToHeader != null && !appendToHeader.isEmpty()) {
    out.println(xpl_note.displayName() + appendToHeader);
   } else {
    out.println(xpl_note.displayName());
     if (outputOperators != null) {
      ((JSONObject) jsonOut.get(JSONObject.getNames(jsonOut)[0])).put(OUTPUT_OPERATORS,
        Arrays.toString(outputOperators.toArray()));
Arrays.sort(methods, new MethodComparator());
      out.print(" ");
     out.println(val);
    List l = val instanceof List ? (List)val : new ArrayList((Set)val);
    if (out != null && !skipHeader && l != null && !l.isEmpty()) {
     out.print(header);
origin: apache/hbase

final List<Cell> results = new ArrayList<>();
final List<Cell> actualKVs = new ArrayList<>();
final String columnRestrictionStr =
  columnArr.length == 0 ? "all columns"
    : ("columns=" + Arrays.toString(columnArr));
final String testDesc =
  "Bloom=" + bloomType + ", compr=" + comprAlgo + ", "
long seekCount = StoreFileScanner.getSeekCount() - initialSeekCount;
if (VERBOSE) {
 System.err.println("Seek count: " + seekCount + ", KVs returned: "
  + actualKVs.size() + ". " + testDesc +
  (lazySeekEnabled ? "\n" : ""));
origin: org.apache.lucene/lucene-core

String lastSegmentsFile = SegmentInfos.getLastCommitSegmentsFileName(files);
if (lastSegmentsFile == null) {
 throw new IndexNotFoundException("no segments* file found in " + dir + ": files: " + Arrays.toString(files));
  delCount += info.getDelCount();
 infoStream.println(String.format(Locale.ROOT, "%.2f%% total deletions; %d documents; %d deleteions",
                  100.*delCount/maxDoc,
                  maxDoc,
 result.segmentInfos.add(segInfoStat);
 msg(infoStream, "  " + (1+i) + " of " + numSegments + ": name=" + info.info.name + " maxDoc=" + info.info.maxDoc());
 segInfoStat.name = info.info.name;
origin: apache/ignite

  /**
   * Traverse tree on the current level and starts procedure of child traversing.
   *
   * @param map The current state of the data.
   * @param nextPnt Next point.
   * @param dimensionNum Dimension number.
   */
  private void traverseTree(Map<Integer, Double[]> map, Double[] nextPnt, int dimensionNum) {
    dimensionNum++;

    if (dimensionNum == sizeOfParamVector){
      Double[] paramSet = Arrays.copyOf(nextPnt, sizeOfParamVector);
      System.out.println(Arrays.toString(paramSet));
      params.add(paramSet);
      return;
    }

    Double[] valuesOfCurrDimension = map.get(dimensionNum);

    for (Double specificValue : valuesOfCurrDimension) {
      nextPnt[dimensionNum] = specificValue;
      traverseTree(map, nextPnt, dimensionNum);
    }
  }
}
origin: apache/incubator-gobblin

private String vectorToString(double[] vector) {
 List<String> tokens = Lists.newArrayListWithCapacity(this.dimensionIndex.size());
 for (Map.Entry<String, Integer> dimension : dimensionIndex.entrySet()) {
  tokens.add(dimension.getKey() + ": " + vector[dimension.getValue()]);
 }
 return Arrays.toString(tokens.toArray());
}
origin: org.apache.logging.log4j/log4j-core

static void assertFileContents(final int runNumber) throws IOException {
  final Path path = Paths.get(FOLDER + "/audit.tmp");
  final List<String> lines = Files.readAllLines(path, Charset.defaultCharset());
  int i = 1;
  final int size = lines.size();
  for (final String string : lines) {
    if (string.startsWith(",,")) {
      final Path folder = Paths.get(FOLDER);
      final File[] files = folder.toFile().listFiles();
      Arrays.sort(files);
      System.out.println("Run " + runNumber + ": " + Arrays.toString(files));
      Assert.fail(
          String.format("Run %,d, line %,d of %,d: \"%s\" in %s", runNumber, i++, size, string, lines));
    }
  }
}
origin: hankcs/HanLP

      break;
    default:
      System.err.printf("最多支持载入3个模型,然而传入了多于3个: %s", Arrays.toString(models));
      return;
  if (option.input == null)
    scanner = new Scanner(System.in);
    scanner = new Scanner(new File(option.input), "utf-8");
System.err.println(e.getMessage());
Args.usage(option);
System.err.println("发生了IO异常,请检查文件路径");
e.printStackTrace();
origin: androidannotations/androidannotations

private List<AndroidAnnotationsPlugin> loadPlugins() throws FileNotFoundException, VersionNotFoundException {
  ServiceLoader<AndroidAnnotationsPlugin> serviceLoader = ServiceLoader.load(AndroidAnnotationsPlugin.class, AndroidAnnotationsPlugin.class.getClassLoader());
  List<AndroidAnnotationsPlugin> plugins = new ArrayList<>();
  for (AndroidAnnotationsPlugin plugin : serviceLoader) {
    plugins.add(plugin);
    if (plugin.shouldCheckApiAndProcessorVersions()) {
      plugin.loadVersion();
    }
  }
  LOGGER.info("Plugins loaded: {}", Arrays.toString(plugins.toArray()));
  return plugins;
}
origin: stackoverflow.com

public static void main(String[] args) throws Exception {
   ArrayList<String[]> listOfStringArrays = new ArrayList<String[]>();
   listOfStringArrays.add(new String[] {"x","y","z"});
   listOfStringArrays.add(new String[] {"a","b","c"});
   listOfStringArrays.add(new String[] {"m","n","o"});
   Collections.sort(listOfStringArrays,new Comparator<String[]>() {
     public int compare(String[] strings, String[] otherStrings) {
       return strings[1].compareTo(otherStrings[1]);
     }
   });
   for (String[] sa : listOfStringArrays) {
     System.out.println(Arrays.toString(sa));
   }
   /* prints out 
    [a, b, c]
    [m, n, o]
    [x, y, z]
   */ 
 }
origin: redisson/redisson

/**
 * Loads the first available library in the collection with the specified
 * {@link ClassLoader}.
 *
 * @throws IllegalArgumentException
 *         if none of the given libraries load successfully.
 */
public static void loadFirstAvailable(ClassLoader loader, String... names) {
  List<Throwable> suppressed = new ArrayList<Throwable>();
  for (String name : names) {
    try {
      load(name, loader);
      return;
    } catch (Throwable t) {
      suppressed.add(t);
      logger.debug("Unable to load the library '{}', trying next name...", name, t);
    }
  }
  IllegalArgumentException iae =
      new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
  ThrowableUtil.addSuppressedAndClear(iae, suppressed);
  throw iae;
}
origin: apache/incubator-gobblin

  throw new IOException(String.format("Path %s does not exist.", path));
 log.info(String.format("Found %d input files at %s: %s", inputs.length, path, Arrays.toString(inputs)));
 for (FileStatus input : inputs) {
  allPaths.add(input.getPath().toString());
  allPaths.size() % maxMappers == 0 ? allPaths.size() / maxMappers : allPaths.size() / maxMappers + 1;
while (pathsIt.hasNext()) {
 Iterator<String> limitedIterator = Iterators.limit(pathsIt, numTasksPerMapper);
 splits.add(new GobblinSplit(Lists.newArrayList(limitedIterator)));
java.utilArraystoString

Javadoc

Creates a String representation of the byte[] passed. The result is surrounded by brackets ( "[]"), each element is converted to a String via the String#valueOf(int) and separated by ", ". If the array is null, then "null" is returned.

Popular methods of Arrays

  • asList
  • 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[
  • deepToString
  • deepHashCode
    Returns a hash code based on the "deep contents" of the specified array. If the array contains other
  • deepToString,
  • 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 IntelliJ plugins
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