TechieDrill Your World Of Technical Tutorials

Posts Tagged ‘array’

Java Static ArrayCopy

11.23.2009 · Posted in Java

Java offers a static ArrayCopy method from System class: java.lang.System.arraycopy() method offers a convenient method to copy array elements from one array to another. System.arraycopy(Object source_array, int source_position, Object destination_array, int destination_position, number_of_elements) System.arraycopy() takes five parameters. First parameter specifies the source_array from where the elements need to be copied. Second parameter is the position(index) value of the source array ...

ByteArrayInputStream

11.22.2009 · Posted in Java

import java.io.*; class ByteArrayInputStreamDemo { public static void main(String [] args) throws IOException { byte data[]=”Here is a String”.getBytes(); ByteArrayInputStream in = new ByteArrayInputStream(data); int ch; while((ch = in.read()) !=-1) { System.out.println(ch+ ” “); System.out.println((char)ch+” “); } } }import java.io.*; class ByteArrayInputStreamDemo { public static void main(String [] args) throws IOException { byte data[]=”Here is a String”.getBytes(); ByteArrayInputStream in = ...