Hi guys,
want to discuss with u guys and begging your opinion or suggestion to solve my problem.

i have this input
input[0]={0,1,2,3}
input[1]={0,1,2}
input[2]={0,1,2,3}
input[3]={0,1}

value=2,3
and when value=3,binary
binary[0]={0,1,1,1}
binary[1]={1,0,1,1}
binary[2]={1,1,0,1}
binary[3]={1,1,1,0}

and when value=2,binary
binary[0]={0,0,1,1}
binary[1]={0,1,1,0}
binary[2]={1,1,0,0}
binary[3]={1,0,0,1}


if user choose value=2,result should b like this:
(i take example for binary[0]={0,1,1})

result[0]={x,x,0,0}
result[1]={x,x,0,1}
result[2]={x,x,1,0}
result[3]={x,x,1,1}
result[4]={x,x,2,0}
result[5]={x,x,2,1}
result[6]={x,x,3,0}
result[7]={x,x,3,1}

as u can see,binary[0][0]=0, 'x' take d place.
if binary[0][1] and binary[0][2]=1,
input[2]={0,1,2,3} and input[3]={0,1} take the place alternately.
binary[0][2]=input[3]
binary[0][1]=input[2]

Binary[a]: b is refer to the address of input.
so if binary[0][2] means refer to input[2].
the conclusion is:
result[0]={x,x,input[2][0],input[3][0]}
result[1]={x,x,input[2][0],input[3][1]}
result[2]={x,x,input[2][1],input[3][0]}
result[3]={x,x,input[2][1],input[3][1]}
result[4]={x,x,input[2][2],input[3][0]}
result[5]={x,x,input[2][2],input[3][1]}
result[6]={x,x,input[2][3],input[3][0]}
result[7]={x,x,input[2][3],input[3][1]}

same thing with binary[1],[2] and so on.

i have no problem if value=2,but if value=3 and value could be more than 3 too cause problem to me.if value=2, i can use for loop but my value should be more than 3 depend on user.

fuh!!!
any suggestion guys???

I don't understand the algorithm you just posted.. do you need Java help or just help with your algorithm, or both? If you only need help with the algorithm then 'Computer Science' would be a better forum for this question IMO. Either way, if nobody else replies soon, maybe you should try rephrasing your question or explaining it differently.

I don't understand the algorithm you just posted.. do you need Java help or just help with your algorithm, or both? If you only need help with the algorithm then 'Computer Science' would be a better forum for this question IMO. Either way, if nobody else replies soon, maybe you should try rephrasing your question or explaining it differently.

oh i see...i want to ask about algorithm.what is algorithm that suitable with my case...thanks for your advice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.