Given array: int[] dimension = { 1, 2, 3 };

That produces the output: 1 2 3 12 13 23 123

I'm new to array...i can't figure out the way on even how to start... any idea?...really appreaciate if someone could help...thanks!

View Answers

March 11, 2011 at 3:26 PM

import java.util.*; class Example{ static ArrayList list = new ArrayList(); public static void generate(String str){ list.add(str); if (str.length() == 1){ list.add(str); return; } for (int i = 0; i < str.length(); i++){ generate(str.substring(0,i) + str.substring(i+1)); } } public static void main(String args[]) { int arr[]={1,2,3}; String st =""; for(int i=0;i<arr.length;i++){ st+=Integer.toString(arr[i]); } generate(st); HashSet set=new HashSet(list); ArrayList l=new ArrayList(set); for(int i=l.size()-1;i>=0;i--){ System.out.println(l.get(i)); } } }

Ads

Related Tutorials/Questions & Answers:

array find all possible dimension Given array: int[] dimension = { 1, 2, 3 }; That produces the output: 1 2 3 12 13 23 123 I'm new to array...i can't figure out the way on even how to start... any idea?...really appreaciate

how to find subarray from given large 2d array of arbritary dimension my code is: import java.lang.*; import java.io.*; import java.io.File; import... to print the subarray of any dimension from given array file. i have tried upto

Advertisements

I want to know the all possible syntax for EL code to print the first element of an array. Which is the correct EL codes syntax to print the first element of an array named employeeArray. ${employeeArray["0"]} or ${employeeArray

JavaScript array dimension In this code we help you to understand array dimension... to make a Two dimension array. The page on loading invoke a function display

Find out last character of array How we can find out the last character of array in java program

javascript:getElementByClassname:Is it possible to collect all the elements with same classname Is it possible to collect all the elements with same classname in a array n display the array by using getElementByClassname

how to print all possible combination that sum to zero?? Ã?Â.... Print all possible combinations that sum to zero Example Enter a num : 7 1... each of the digits so that the resultant sum is zero. Print all posible

it possible or not without public static void main(string args[]) in java program it is possible

Find position of an array element In this section, you will learn how to find the index of an array element. For this, we have allowed the user to enter the array elements of their choice and also the number whose index value

USE ARRAY TO FIND THE LARGEST NUMBER AND OCCURRENCE i have some exercise from my lecturer and I still can't understand about ARRAY. here it is: write a program that reads 10 numbers from the keyboard. find the largest number

Find a missing element from array We have two arrays A and B where B consists of all the elements that are present in A but one element is missing from the array B. From these two arrays, we have to find the missing element from

To find first two maximum numbers in an array Java program to find first two maximum numbers in an array,using single loop without sorting array

Itried all possible ways still getting thesame error java.sql.SQLException: Io exception: Got minus one from a read call at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112

find all unique character in string using java example: hello how are you. output should be waryu

Find sum of all the elements of matrix using Java A matrix is a rectangular array of numbers. The numbers in the matrix are called its entries or its elements... dimensional array. Now to determine the sum of all these elements, we have

Find Second Largest Number from an Array This section illustrates you how to find the second largest number from an array. For this purpose, we have allowed the user to enter the array elements of their choice and determine the largest

To find first two maximum numbers in an array,using single loop without sorting array. Java program to find first two maximum numbers in an array,using single loop without sorting array

To find first two maximum numbers in an array,using single loop without sorting array. Java program to find first two maximum numbers in an array,using single loop without sorting array

How to find list of all index in Neo4j? Hi, I have database in Neo4j and I want to find the list of all the indexes in it. How to get the list of all indexes in Neo4j database? Thanks Hi, Login to Node4j admin

array accept all data type how can create array that accept all data type??? if we can solution it? how.. Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public

array accept all data type how can create array that accept all data type??? if we can solution it? how.. Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public

Two - dimension arraylist how to create two - dimension arraylist in jsp-servlet

sql php array SQL PHP Array support simple dimension array. The SQL PHP Array is used to populate array from MySQL database. Understand with Example The Tutorial

Find Array element from index using GUI In this tutorial, you will learn how to create an GUI application to find an array element from its index. For this, we have created an an array of 100 randomly chosen integers and allow

how to find inverse of n*n 2d array in java I reached upto code of printing the matrix as: Assume that matrix is square matrix where row=column code is: public class ReadContents{ public static void main(String args

Insertion sort program find calendar to array value 1000,5000,10000 program find calendar for insertion sort in jfram to array 1000

cannot find symbol class array queue--plzz somebody help.. import java.util.*; public class Test { public static void main(String[] args) { ArrayQueue<String> q = new ArrayQueue<String>(6); System.out.println

write a java program to find the summation of all the integers entered on command line Hi, write a java program to find the summation of all the integers entered on command line? How to write Java program for summation of all

Find sum of the squares of Array elements In this section, you will learn how to compute the sum of the squares of the array elements. For this, we have allowed the user to enter 5 numbers, to be stored into the array. Then we have

How to Print Array in JavaScript In this section you will learn about Array in JavaScript. Array are important part of all programming languages. Array...;; There are some methods of array that can use in array like length() can find

Array is it possible to define array like this..? int[] intArray = new int[] {4,5,6,7,8}; Explain...? Yes, you can. Java Initialize Array