Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners array find all possible dimension
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


kanetan
array find all possible dimension
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


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!


Advertisement
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));
        }
    }
}


Related Tutorials/Questions & Answers:
array find all possible dimension
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
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.
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
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
how to print all possible combination that sum to zero??
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
javascript:getElementByClassname:Is it possible to collect all the elements with same classname
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
it possible or not
it possible or not  without public static void main(string args[]) in java program it is possible
Itried all possible ways still getting thesame error
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 out last character of array
Find out last character of array  How we can find out the last character of array in java program
find all unique character in string using java
find all unique character in string using java  example: hello how are you. output should be waryu
array accept all data type
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
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
Find position of an array element
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
Find a missing element from array
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
USE ARRAY TO FIND THE LARGEST NUMBER AND OCCURRENCE
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
To find first two maximum numbers in an array
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
Two - dimension arraylist
Two - dimension arraylist  how to create two - dimension arraylist in jsp-servlet
Find sum of all the elements of matrix using Java
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
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
sql php array
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
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
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
Find Array element from index using GUI
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
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
cannot find symbol class array queue--plzz somebody help..
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
please please i wanna insertion sort program find calendar to array value (1000,5000,10000), please help me
Insertion sort program find calendar to array value 1000,5000,10000  program find calendar for insertion sort in jfram to array 1000
Is it possible in SWT ?
Is it possible in SWT ?  I want drop down like google search (ie, when we type one letter then the word start with that are displayed). when the drop down list appear, then we can select one of word as our text box value. Can i
Find sum of the squares of Array elements
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
Find in Array - Calculate Occurrences of Elements in Array
Find in Array - Calculate Occurrences of Elements in Array... to calculate occurrences of elements in an array. Occurrences means, the how many times an element occurs in the array. In this section, you will get more and more
How to Print Array in JavaScript
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
 

 

 

DMCA.com