Task2 Remove an element with in an Array

import java.util.*;

public class ArrayEx {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] intArray = new int[] {1, 6, 0, 4, 2, 8, 7, 5, 9, 3};

int[] arrayCopy = new int[intArray.length];
System.out.println(“entered”);
System.arraycopy(intArray, 0, arrayCopy, 0,intArray.length);
Arrays.sort(arrayCopy);
for (int i = 0; i < 4; i++)
System.out.println(arrayCopy[i]);
int[] x=Arrays.copyOf(arrayCopy, 4);
for (int i = 0; i < 4; i++)
System.out.println(“x=”+x[i]);
// String s=”hai”;
StringBuffer buf=new StringBuffer(“raju”);
String rev=buf.reverse().toString();
String yourString=”hi hello hi hi”,naga;
System.out.println(yourString);
naga = yourString.replaceAll(“\\s+”, ” “);
System.out.println(naga);
System.out.println(rev);
}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s