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[] args) { FloatBuffer floatBuffer = FloatBuffer.allocate(10); floatBuffer.put(0, 1.23F);//from ww w . j a v a 2 s . co m floatBuffer.rewind(); float[] floatArray = new float[10]; floatBuffer.get(floatArray, 0, 3); System.out.println(Arrays.toString(floatArray)); }
From source file:Main.java
public static void main(String[] args) { LinkedHashSet linkedHashSet = new LinkedHashSet(10); linkedHashSet.add("1"); linkedHashSet.add("2"); linkedHashSet.add("java2s.com"); Object[] objArray = linkedHashSet.toArray(); System.out.println(Arrays.toString(objArray)); }
From source file:Main.java
public static void main(String[] args) { SecureRandom secureRandom = new SecureRandom(new byte[] { 1, 3, 3, 7 }); int[] randoms = IntStream.generate(secureRandom::nextInt).filter(n -> n > 0).limit(10).toArray(); System.out.println(Arrays.toString(randoms)); int[] nums = IntStream.iterate(1, n -> n * 2).limit(11).toArray(); System.out.println(Arrays.toString(nums)); }
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.putShort(2, (short) 123); ByteBuffer bb = bbuf.slice(); System.out.println(Arrays.toString(bb.array())); }
From source file:Main.java
public static void main(String args[]) { LinkedList<String> ll = new LinkedList<String>(); ll.add("A");/*from w w w. j av a2 s .c o m*/ ll.add("java2s.com"); ll.add("B"); ll.add("C"); ll.add("java2s.com"); Object[] objs = ll.toArray(); System.out.println(Arrays.toString(objs)); String[] strs = ll.toArray(new String[ll.size()]); System.out.println(Arrays.toString(strs)); }
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.putShort(2, (short) 123); ByteBuffer bb = bbuf.compact(); System.out.println(Arrays.toString(bb.array())); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0);//from w w w . java 2s . com bitset1.set(1); bitset1.set(2); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println(Arrays.toString(bitset1.toLongArray())); }
From source file:Main.java
public static void main(String[] args) { LinkedHashSet linkedHashSet = new LinkedHashSet(10, 0.75F); linkedHashSet.add("1"); linkedHashSet.add("2"); linkedHashSet.add("java2s.com"); Object[] objArray = linkedHashSet.toArray(); System.out.println(Arrays.toString(objArray)); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0);// w w w. j a v a 2s .co m bitset1.set(1); bitset1.set(2); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println(Arrays.toString(bitset1.toByteArray())); }
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.putShort(2, (short) 123); ByteBuffer bb = bbuf.duplicate(); System.out.println(Arrays.toString(bb.array())); }