Java - exclude array positions from a already declared array -


In this way, the code below creates an integer array with 100 positions, makes some math and each in the array posts Returns the result value, and the finally shows all the values ​​inside the array in Jelabal. The problem is: The last line will show all array values ​​from 0 to 100, so even if no array condition is used, it will be shown with "zero" value on the screen, and I do not want it in the same way, I just want to show those posts which actually get a price. I am thinking of excluding those posts which should not be shown to me so that they do not go to JLABB. It's running like this now:

If I say that xconv ​​is "13", with the code below, the number that I will get and will be shown on jlabble "[1, 0, 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ... ... (up to the hundredth place) ".

I should show it like this: If I say xconv ​​is "13", the number will be "[1,0,1,1]"

Thanks! !! !

  int [] resto = new int [100]; For (int cont = 0; xconv! = 0; ++ cont) {resto [cont] = xconv% 2; Xconv = xconv ​​/ 2; } JLabel1.setText (arrays.toString (resto));    

Print only the tap value

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -