Hello,
I'm on an application from a server logs produces statistics on this one. However I encounter some difficulties and I'd like your help . Let me explain:
I put the logs in a 2D array (online information). Subsequently, I created a map with key as the name of a database and I value is the connection time on the latter in milliseconds.
Code:
Map m = new TreeMap ();
for (int i = 0; i <x; i + +)
(
Object o = m.get (Logsession [i] [3]);
if (o == null)
m.put (Logsession [i] [3], new Integer (Integer.parseInt (Logsession [i] [1 ])));
else
(
(
Integer cnt = (Integer) o;
m.put (Logsession [i] [3], new Integer (cnt.intValue () + Integer.parseInt (Logsession [i] [1 ])));
))
)
List ky = new ArrayList (m.kySet ());
Iterator it = ky.it ();
while (it.hasNext ())
(
Object ky = Iterator.next ();
nb = Integer.parseInt ((String) m.get (ky)) / (1000 * 60 * 60);
modulo =Integer.parseInt ((String) m.get (ky))% (1000 * 60 * 60);
nbMin = mod / (60 * 1000);
modulo = modulo% (60 * 1000);
nbSec = modulo/1000;
label = new JLabel ( "Time of connection to the Database" + ky + ":" + nb + "hours," nbMin + + "minutes and" + nbSec + "seconds");
)
Bookmarks