How to convert byte array to base64 String
<pre><code>List&lt;Map&lt;String, Object&gt;&gt; lists = baseDao.getJdbcTemplate().queryForList(queryForImages, productId);
        **System.out.println("size----" + lists.size());**
        ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;();
        for (Map&lt;String, Object&gt; base64 : lists) {
            byte[] imgData = (byte[]) base64.get("images");
            String base64Encoded = new String(imgData, StandardCharsets.UTF_8);
            // byte[] encodedImage = Base64.encodeBase64(imgData);
            System.out.println("encoded---2" + base64Encoded);
        }
</code></pre>

<p>i retrieve list of images from db and convert byte array to base64 string ,if i sysout only the last image in the list prints in sysout , even sysout list.size under the method is not printing . </p>