Dear Atul Mishra,
With my limited knowledge what I prefer is :
1) Get the values the db returns & store it in a file
dbresults.txt
2) Next use a forloop(i=1 to 3) & stringtokenizer to parse through the tokens.
Set the stringtokenizer delimiter as i, so for i=1 you have
a b c
3) Store the i value in a
String array of array with length 3
4) Now get values from array & use string formatter like String.format.
This is my opinion , but which I haven't tried.
Regards.