BatchUtil { public static String getMemoryInfo() { DecimalFormat f1 = new DecimalFormat("#,###KB"); DecimalFormat f2 = new DecimalFormat("##.#"); Runtime rt = Runtime.getRuntime(); long free = rt.freeMemory() / 1024; long total = rt.totalMemory() / 1024; long max = rt.maxMemory() / 1024; long used = total - free; double ratio = used * 100 / (double) total; StringBuilder sb = new StringBuilder(); sb.append("Java memory info : "); sb.append("used="); sb.append(f1.format(used)); sb.append(" ("); sb.append(f2.format(ratio)); sb.append("%), "); sb.append("total="); sb.append(f1.format(total)); sb.append(", "); sb.append("max="); sb.append(f1.format(max)); return sb.toString(); } protected  BatchUtil(); static String cat(Object... args); static String getInfoLogStartMsg(String jobCd); static String getInfoLogEndMsg(String jobCd); static TransactionDefinition getTransactionDefinition(); static TransactionDefinition getTransactionDefinition(
            int propagationBehavior, int isolationLevel, int timeout,
            boolean readOnly); static TransactionStatus startTransaction(
            PlatformTransactionManager tran); static TransactionStatus startTransaction(
            PlatformTransactionManager tran, Log log); static TransactionStatus startTransaction(
            PlatformTransactionManager tran, int propagationBehavior,
            int isolationLevel, int timeout, boolean readOnly); static TransactionStatus startTransaction(
            PlatformTransactionManager tran, int propagationBehavior,
            int isolationLevel, int timeout, boolean readOnly, Log log); static TransactionStatus startTransaction(
            PlatformTransactionManager tran, TransactionDefinition def); static TransactionStatus startTransaction(
            PlatformTransactionManager tran, TransactionDefinition def, Log log); static Map<String, TransactionStatus> startTransactions(
            TransactionDefinition tranDef, Map<?, ?> tranMap); static Map<String, TransactionStatus> startTransactions(
            TransactionDefinition tranDef, Map<?, ?> tranMap, Log log); static void commitTransaction(PlatformTransactionManager tran,
            TransactionStatus stat); static void commitTransaction(PlatformTransactionManager tran,
            TransactionStatus stat, Log log); static void commitTransactions(Map<?, ?> tranMap,
            Map<String, TransactionStatus> statMap); static void commitTransactions(Map<?, ?> tranMap,
            Map<String, TransactionStatus> statMap, Log log); static void endTransaction(PlatformTransactionManager tran,
            TransactionStatus stat); static void endTransaction(PlatformTransactionManager tran,
            TransactionStatus stat, Log log); static boolean endTransactions(Map<?, ?> tranMap,
            Map<String, TransactionStatus> statMap); static boolean endTransactions(Map<?, ?> tranMap,
            Map<String, TransactionStatus> statMap, Log log); static Object setSavepoint(TransactionStatus stat); static Object setSavepoint(TransactionStatus stat, Log log); static void releaseSavepoint(TransactionStatus stat, Object savepoint); static void releaseSavepoint(TransactionStatus stat,
            Object savepoint, Log log); static void rollbackSavepoint(TransactionStatus stat,
            Object savepoint); static void rollbackSavepoint(TransactionStatus stat,
            Object savepoint, Log log); static void rollbackTransaction(PlatformTransactionManager tran,
            TransactionStatus stat); static void rollbackTransaction(PlatformTransactionManager tran,
            TransactionStatus stat, Log log); static TransactionStatus commitRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat); static TransactionStatus commitRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat, Log log); static TransactionStatus commitRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat,
            TransactionDefinition def); static TransactionStatus commitRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat,
            TransactionDefinition def, Log log); static TransactionStatus rollbackRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat); static TransactionStatus rollbackRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat, Log log); static TransactionStatus rollbackRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat,
            TransactionDefinition def); static TransactionStatus rollbackRestartTransaction(
            PlatformTransactionManager tran, TransactionStatus stat,
            TransactionDefinition def, Log log); @SuppressWarnings({"rawtypes", "unchecked"}) static E[] changeListToArray(List<E> list, Class clazz); static List<String> getProperties(String propertyName, String grpKey); static String getMemoryInfo();  }
@Test public void testGetMemoryInfo001() throws Exception { String info = BatchUtil.getMemoryInfo(); assertNotNull(info); assertTrue(info.startsWith("Java memory info : ")); }