static void arrangebySign(int a[],int s){ 		 		int j=0,temp; 		for(int i=0;i<s;i++){ 			if(a[i]<0){ 				if(i != j){ 					temp=a[i]; 					a[i]=a[j]; 					a[j]=temp; 				} 				j++; 			} 			 		} 		 	}

Read more of this post