List of usage examples for java.util Arrays toString
public static String toString(Object[] a)
From source file:Main.java
public static void main(String[] argv) throws Exception { int capacity = 10; ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(capacity); for (int i = 0; i < 10; i++) { queue.add(i);//from w w w. ja v a 2 s . c o m } System.out.println(Arrays.toString(queue.toArray(new Integer[queue.size()]))); }
From source file:Main.java
public static void main(String[] args) { int[] sourceInts = { 12, 78 }; int[] destInts = new int[2]; for (int i = 0; i < Array.getLength(sourceInts); i++) { Array.set(destInts, i, Array.get(sourceInts, i)); System.out.println(Array.get(destInts, i)); }/*from w w w. j av a2 s . com*/ System.out.println(Arrays.toString(destInts)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.order(ByteOrder.LITTLE_ENDIAN); bbuf.put("java2s.com".getBytes()); System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.order(ByteOrder.nativeOrder()); bbuf.put("java2s.com".getBytes()); System.out.println(Arrays.toString(bbuf.array())); }
From source file:Main.java
public static void main(String[] args) { DoubleBuffer bb = DoubleBuffer.allocate(BSIZE); bb.put(98765);/*from w w w.j a v a2s .c om*/ DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE); double[] doubleArray = new double[BSIZE]; bb1.get(doubleArray); System.out.println(Arrays.toString(doubleArray)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { ByteBuffer bbuf = ByteBuffer.allocate(10); int capacity = bbuf.capacity(); // 10 System.out.println(capacity); bbuf.put("java2s.com".getBytes(), 0, 2); ByteBuffer bbuf1 = ByteBuffer.allocate(10); bbuf1.put(bbuf);//from w w w . j av a2 s . c o m System.out.println(Arrays.toString(bbuf1.array())); }
From source file:Main.java
public static void main(String[] args) { // create array list object List<Integer> numbers = new ArrayList<Integer>(); // populate the list for (int i = 0; i < 15; i++) { numbers.add(i);/*from w w w . j a v a 2s . c om*/ } System.out.println("Before : " + Arrays.toString(numbers.toArray())); // rotate the list at distance 10 Collections.rotate(numbers, 10); System.out.println("After : " + Arrays.toString(numbers.toArray())); }
From source file:Main.java
public static void main(String[] args) { String[] testArray = { "/", "/games/", "/homework/", "/usr/", "/games/snake/", "/temp/downloads/", "/usr/local/", "/usr/local/bin/" }; Comparator<String> pathComparator = new PathComparator(); Arrays.sort(testArray, pathComparator); System.out.println(Arrays.toString(testArray)); }
From source file:Main.java
public static void main(String[] args) { Set<Integer> numberSet = new HashSet<Integer>() { {//w w w . j a va 2s . c o m add(1); add(2); add(3); } }; Stream<Integer> collectionStream = numberSet.stream(); System.out.println(Arrays.toString(collectionStream.toArray())); }
From source file:Main.java
public static void main(final String[] args) throws Exception { Random random = new Random(); Set<Integer> intSet = new HashSet<>(); while (intSet.size() < 6) { intSet.add(random.nextInt(49) + 1); }/*from w w w . j a v a2 s . c o m*/ Integer[] ints = intSet.toArray(new Integer[intSet.size()]); System.out.println(Arrays.toString(ints)); }