java - Multidimensional array column swap -
There are no numbers after identifying that element in a specific column of a multi-dimensional array. Two columns array of this multidimensional array.
Actually I would like to swap the content of column 6 in column 6 with those people, after determining whether the elements in column 6 are or not, so if the element number of column 6 Let's create a new array and insert the old array content in the new array, but once the column moves to the fourth column of the old array, it gives this element the 6th column of the new array and vice versa. .
I have been able to successfully identify the attempts given below about the attempts given below that the elements of my column 6 are or not, in the 6 me now, with the people swapping the elements in 4 There is doubt about logic.
//! & Lt; Public String [] [] sortedByDateUsageStatsData (String [] [] unsortedUsageStatsData) {System.out.println ( "\ nbtnUsageStats - [sortedDateUsageStatsData (string []] unsortedUsageStatsData)"); For (int row = 0; row & lt; unsortedUsageStatsData.length; row ++) to {(Int col = 0; col & lt; 7; col ++) {//System.out.println ( "unsortedUsageStatsData ["+ + Row +"] ["+ ColE +"] = & gt; "+ Unread Usage Static Data [Row] [Col.]); } // Check whether the content in the return code column i.e. Column 6 is the number or string. // If a string then swaps the contents of column 4 with column 6 and passes this array with the swaped columns as the last array (if it is!)! (Responsible usage Statsdeta [0] [6])) {//System.out.println ( "unsortedUsageStatsData [0] [6] is not a number, ie" + unsortedUsageStatsData [0] [6]); break; } System.out.println ("\ n"); } System.out.println ("\ n Unsorted Usage Statsdata is not a [0] [6] number specified for loop \ n"); SortedUsageStatsData = new string [unsortedUsageStatsData.length] [7]; For {int row = 0; line & lt; unsortedUsageStatsData.length; line ++} {{int col = 0; col & lt; 7; col ++} {//System.out.println (" N \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ "] [" + Col + "] = & gt; "+ unsortedUsageStatsData [row] [col]); sorted Gyausejastatdeta [row] [Cola] = organize without Ugstatdeta [row] [Cola]; If (col == 4) {System.out.println (" \ N Swap Sorted Usage Statdata ["+ + + +]] [6] = & gt;" + unsortedUsageStatsData [line] [6]) before; SortedOurJestatData [row] [6] = Unmanaged Usage Statsdata [row] [4]; System.out.println ("\ n Swap Sorted UsageState Data [" + + Row + "] [6] = & gt;" + unsortedUsageStatsData [line] [6]); SortedOurStateStateData [row] [4] = Unmanaged UsageStateData [row] [6]; System.out.println ( "\ n Swap sorted usage Statdeta [" + + + + +] [4] = & gt; "+ unsortedUsageStatsData [row] [4]);} System.out.println (" \ n Swap sorted usage Statdetadeta [ "+ line +"] + "+ + + +"] = & gt; "+ Unread usage Statdeta [row] [col]);} System.out.println (" \ n ");} Sorted Usage StatsData;}
Any help is appreciated.
There is a problem with your loop in recurrence where col == 6
you assign to sortedUsageStatsData [row] [6]
Override, you had already set up (when the call was 4).
There are some ways to change this, I will say two names:
-
Changes in only 0 to 5: for
(int col = 0; col & lt; 6; curl ++)
. -
Similar iterations Set the values of columns 4 and 6 in:
if (col == 4) {sortedUsageStatsData [line] [4] = unmanaged Usage stats [row] [6]; } And if (column == 6) {sortedUsageStatsData [row] [6] = unmanaged usage statadata [row] [4]; }
Comments
Post a Comment