i want the array to run from one place in diagnol to another place in the array.

i set the arguments. here they are

int rowStart=3;
		int rowEnd=5;
		int columnStart=3;
		int columnEnd=5;
		
		
		int columnX=columnEnd-columnStart;
		
		int rowY=rowEnd-rowStart;

here is the single loop that i prepared:

if (rowY>0 && columnX>0){
						

							
						
while(pieces[rowStart+a][columnStart+a]==null && columnStart+a>columnEnd && rowStart+a>rowEnd){						
									
	a++;
									}
									
									System.out.println("BishopSouthEast   This is a "+a); 
									
							
				
if(a<rowY && a<columnX){
	 BishopNorthEast=false;
	System.out.println("BishopSouthEast   This is a "+a+" and this is the square places disparity "+ rowY);
 System.out.println("BishopSouthEast    This is a "+a+" and this is the square places disparity "+ columnX);
    System.out.println("BishopSouthEast   This is a This value is false");
					            }
		  else{
BishopNorthEast=true;
	      System.out.println("BishopSouthEast       This is a "+a+" and this is the square places disparity "+ columnX); 
	   System.out.println("BishopSouthEast       This is a "+a+" and this is the square places disparity "+ rowY); 
					        System.out.println("BishopSouthEast        This is a This value is true");
					            }
				
	}

why the a is returned always as 0 and not being counted even once?
(i tested, there are nulls only from point to point)

Your while loop seems to require

columnStart+a>columnEnd && rowStart+a>rowEnd

columnStart and rowStart are smaller numbers than the end, which is 5 i think, and a is 0 , so it would never execute the while loop, if i have enough information to make that conclusion.

Mike

while(pieces[rowStart+a][columnStart+a]==null && columnStart+a>columnEnd && rowStart+a>rowEnd){

isnt that what i already have here?

yes. that is the line of code i took my snippet from.

SO why is it not working?

What about my original response to your first post did you not understand? Beyond saying that i took some code out of a while loop of yours, did you read my response? Do you know why i posted that code? I offered some commentary in the post. I did not just quote your code and point a finger at it.

Mike

i read your response mike , i am sorry, i couldnt understand. how can i correct my code so it will be executed?

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.