### Question:
MovingSpacesToStartOfString { public static void moveSpaces(char[] str) { if (str == null || str.length == 0) { return; } int i = str.length - 1; int j = str.length - 1; while (i >= 0) { if (str[i] == ' ') { i--; continue; } if (i < j) { char t = str[i]; str[i] = str[j]; str[j] = t; } i--; j--; } while (j >= 0) { str[j--] = ' '; } }  static void moveSpaces(char[] str);  }### Answer:
@Test public void testMoveSpaces() { String original = str == null ? null : new String(str); moveSpaces(str); assertThat("Result for character array of string = " + original + " is not expected", str, is(expected)); }