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 { String testStr = "One, Two, and Three."; System.out.println("Original string: " + testStr); String[] result = testStr.split("\\W+"); System.out.print("Split at word boundaries: "); System.out.println(Arrays.toString(result)); }
From source file:Main.java
public static void main(String[] args) { Integer[] points = new Integer[5]; points[0] = 4;/*w w w . j a va2s. c o m*/ points[1] = 3; points[2] = 0; points[3] = 4; points[4] = 4; Arrays.sort(points); System.out.println(Arrays.toString(points)); Arrays.sort(points, Collections.reverseOrder()); System.out.println(Arrays.toString(points)); }
From source file:Main.java
public static void main(String[] args) { ShortBuffer bb = ShortBuffer.allocate(10); bb.put((short) 100); bb.rewind();/* ww w . j a v a2 s . com*/ ShortBuffer shortBuffer2 = ShortBuffer.allocate(10); shortBuffer2.put(bb); System.out.println(Arrays.toString(shortBuffer2.array())); }
From source file:Main.java
public static void main(String[] args) { DoubleBuffer bb = DoubleBuffer.allocate(BSIZE); bb.put(98765);/*from ww w.java 2 s. com*/ DoubleBuffer bb1 = DoubleBuffer.allocate(BSIZE); bb1.put(bb); System.out.println(Arrays.toString(bb1.array())); }
From source file:Main.java
public static void main(String[] args) { // A string array with duplicate values String[] data = { "A", "C", "B", "D", "A", "B", "E", "D", "B", "C" }; System.out.println("Original array : " + Arrays.toString(data)); List<String> list = Arrays.asList(data); Set<String> set = new HashSet<String>(list); System.out.print("Remove duplicate result: "); String[] result = new String[set.size()]; set.toArray(result);// w w w. j av a 2s. c om for (String s : result) { System.out.print(s + ", "); } }
From source file:Main.java
public static void main(String[] args) { ByteBuffer bb = ByteBuffer.allocate(BSIZE); bb.asCharBuffer().put("java2s!"); bb.rewind();/*from w w w.j av a2 s. com*/ byte[] dst = new byte[BSIZE]; bb.get(dst); System.out.println(Arrays.toString(dst)); }
From source file:Main.java
public static void main(String[] args) { FloatBuffer floatBuffer = FloatBuffer.allocate(10); floatBuffer.put(0, 1.23F);/*from ww w . ja v a 2 s . co m*/ floatBuffer.rewind(); float[] floatArray = new float[10]; floatBuffer.get(floatArray); System.out.println(Arrays.toString(floatArray)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String testStr = "This;:, is:;:;:;. a!:; test?"; System.out.println("Original string: " + testStr); String[] result = testStr.split("[.,!?:;]+\\s*"); System.out.print("Split on various punctuation: "); System.out.println(Arrays.toString(result)); }
From source file:Main.java
public static void main(String[] args) { Random rand = new Random(); int randnumb; int array[] = new int[5]; for (int j = 0; j <= 4; j++) { randnumb = 1 + rand.nextInt(11); array[j] = randnumb;//ww w. ja v a 2 s .com } System.out.println(Arrays.toString(array)); }
From source file:Main.java
public static void main(String[] args) { ByteBuffer bb = ByteBuffer.allocate(BSIZE); bb.asCharBuffer().put("java2s!"); byte[] dst = new byte[BSIZE]; bb.rewind();//from w w w.j a v a2s. c o m bb.get(dst, 0, 3); System.out.println(Arrays.toString(dst)); }