@Test public void parametersToString() { class TestCase { String mExpected; Object[] mInput; public TestCase(String expected, Object[] objs) { mExpected = expected; mInput = objs; } } List<TestCase> testCases = new ArrayList<>(); testCases.add(new TestCase("()", null)); testCases.add(new TestCase("(null)", new Object[] {null})); testCases.add(new TestCase("()", new Object[] {""})); testCases.add(new TestCase("(foo)", new Object[] {"foo"})); testCases.add(new TestCase("(foo, bar)", new Object[] {"foo", "bar"})); testCases.add(new TestCase("(foo, , bar)", new Object[] {"foo", "", "bar"})); testCases.add(new TestCase("(, foo, )", new Object[] {"", "foo", ""})); testCases.add(new TestCase("(, , )", new Object[] {"", "", ""})); testCases.add(new TestCase("(1)", new Object[] {1})); testCases.add(new TestCase("(1, 2, 3)", new Object[] {1, 2, 3})); for (TestCase testCase : testCases) { assertEquals(testCase.mExpected, FormatUtils.parametersToString(testCase.mInput)); } }
public static String parametersToString(Object... objs) { StringBuilder sb = new StringBuilder("("); if (objs != null) { for (int k = 0; k < objs.length; k++) { if (k != 0) { sb.append(", "); } if (objs[k] == null) { sb.append("null"); } else { sb.append(objs[k].toString()); } } } sb.append(")"); return sb.toString(); }
FormatUtils { public static String parametersToString(Object... objs) { StringBuilder sb = new StringBuilder("("); if (objs != null) { for (int k = 0; k < objs.length; k++) { if (k != 0) { sb.append(", "); } if (objs[k] == null) { sb.append("null"); } else { sb.append(objs[k].toString()); } } } sb.append(")"); return sb.toString(); } }
FormatUtils { public static String parametersToString(Object... objs) { StringBuilder sb = new StringBuilder("("); if (objs != null) { for (int k = 0; k < objs.length; k++) { if (k != 0) { sb.append(", "); } if (objs[k] == null) { sb.append("null"); } else { sb.append(objs[k].toString()); } } } sb.append(")"); return sb.toString(); } private  FormatUtils(); }
FormatUtils { public static String parametersToString(Object... objs) { StringBuilder sb = new StringBuilder("("); if (objs != null) { for (int k = 0; k < objs.length; k++) { if (k != 0) { sb.append(", "); } if (objs[k] == null) { sb.append("null"); } else { sb.append(objs[k].toString()); } } } sb.append(")"); return sb.toString(); } private  FormatUtils(); static String parametersToString(Object... objs); static String byteBufferToString(ByteBuffer buf); static String byteArrayToHexString(byte[] bytes); static String byteArrayToHexString(byte[] bytes, String prefix, String separator); static String formatTimeTakenMs(long startTimeMs, String message); static String formatTimeTakenNs(long startTimeNs, String message); static String getSizeFromBytes(long bytes); static long parseSpaceSize(String spaceSize); static long parseTimeSize(String timeSize); static String formatMode(short mode, boolean directory, boolean hasExtended); }
FormatUtils { public static String parametersToString(Object... objs) { StringBuilder sb = new StringBuilder("("); if (objs != null) { for (int k = 0; k < objs.length; k++) { if (k != 0) { sb.append(", "); } if (objs[k] == null) { sb.append("null"); } else { sb.append(objs[k].toString()); } } } sb.append(")"); return sb.toString(); } private  FormatUtils(); static String parametersToString(Object... objs); static String byteBufferToString(ByteBuffer buf); static String byteArrayToHexString(byte[] bytes); static String byteArrayToHexString(byte[] bytes, String prefix, String separator); static String formatTimeTakenMs(long startTimeMs, String message); static String formatTimeTakenNs(long startTimeNs, String message); static String getSizeFromBytes(long bytes); static long parseSpaceSize(String spaceSize); static long parseTimeSize(String timeSize); static String formatMode(short mode, boolean directory, boolean hasExtended);  }