static public String toString( float fs[] ) { SB sb = new SB(); sb.p('['); for( float f : fs ) sb.p(f==Float.MAX_VALUE ? "max": (f==-Float.MAX_VALUE ? "min": Float.toString(f))).p(','); return sb.p(']').toString(); }
/** * @param flags Flags. * @return String builder containing all flags. */ static String toString(short flags) { SB sb = new SB(); for (Mask m : MASKS) { if (m.ordinal() != 0) sb.a('|'); sb.a(m.name().toLowerCase()).a('=').a(m.bit(flags)); } return sb.toString(); }
/** * Builds ignite.sh attributes to set up SSH username and password and log directory for started * node. * * @param username SSH user name. * @param host Host. * @return {@code ignite.sh} script arguments. */ private String buildRemoteLogArguments(String username, String host) { assert username != null; assert host != null; SB sb = new SB(); sb.a(" -J-D") .a(IGNITE_SSH_HOST) .a("=\"") .a(host) .a("\"") .a(" -J-D") .a(IGNITE_SSH_USER_NAME) .a("=\"") .a(username) .a("\""); return sb.toString(); }
/** * Pretty-formatting for duration. * * @param ms Millisecond to format. * @return Formatted presentation. */ private static String formatDuration(long ms) { assert ms >= 0; if (ms == 0) return "< 1 ms"; SB sb = new SB(); long dd = ms / 1440000; // 1440 mins = 60 mins * 24 hours if (dd > 0) sb.a(dd).a(dd == 1 ? " day " : " days "); ms %= 1440000; long hh = ms / 60000; if (hh > 0) sb.a(hh).a(hh == 1 ? " hour " : " hours "); long min = ms / 60000; if (min > 0) sb.a(min).a(min == 1 ? " min " : " mins "); ms %= 60000; if (ms > 0) sb.a(ms).a(" ms "); return sb.toString().trim(); }