Skip to content

Instantly share code, notes, and snippets.

@blackeangel
Created October 12, 2017 11:39
Show Gist options
  • Save blackeangel/28c82ff3aeed54c212609fd800033383 to your computer and use it in GitHub Desktop.
Save blackeangel/28c82ff3aeed54c212609fd800033383 to your computer and use it in GitHub Desktop.
public static String[][] DelEmptyRowTwoDArray(String[][] mass) {
int k = 0;
int m;
for (int i = 0; i < mass.length; i++) {
m = 0;
for (int j = 0; j < mass[0].length; j++) {
if (mass[i][j] == null) {
m = m + 1;
}
}
if (m != mass[0].length) {
k = k + 1;
}
}
int n = 0;
String[][] new_mass = new String[k][mass[0].length];
for (int i = 0; i < mass.length; i++) {
if (mass[i][0] != null) {
for (int j = 0; j < mass[0].length; j++) {
new_mass[n][j] = mass[i][j];
}
n++;
}
}
return new_mass;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment