Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
import java.util.Arrays;
public class Demo {
public static void main(String[] args) {
String[] strArr = new String[] { "r", "p", "v","y", "s", "q" };
Arrays.sort(strArr, 2, 6);
System.out.println("Sorted subset of array elements from index 2 to 6...");
for (int a = 0; a<strArr.length; a++) {
System.out.println(strArr[a]);
}
}
}
import java.util.Arrays;
import java.util.Date;
public class Demo {
public static void main(String[] args) {
int[] arr = new int[1000];
for (int i = 0; i<arr.length; i++) {
arr[i] = (int) (i + 20);
}
Date past = new Date();
Arrays.sort(arr);
Date future = new Date();
System.out.println("Time (milliseconds) = " + (future.getTime() - past.getTime()));
}
}
#include <iostream>
#include <iostream>
#include <fstream>
using namespace std;
int main() {
fstream newfile;
newfile.open("tpoint.txt", ios::out); //open a file to perform write operation using file object
newfile << "Tutorials Point"; //inserting data
cout << "The present position of the pointer in the file: "
<< newfile.tellp() << endl; //position of the pointer in the file object
newfile.close(); //close file object.
}
public class Demo {
public static void main(String[] args) {
int[] list = new int[50];
for (int i = 0; i<list.length; i++) {
list[i] = (int) (i + 20);
}
int output = 0;
for (int i = 0; i<list.length; i++) {
if (output == 5) {
System.out.println();
output = 0;
}
System.out.print(list[i] + ", ");
output++;
}
}
}