Different ways to compare the java objects

Hi,
I want to compare rather search one object in collection of thousands of objects.
And now i am using the method which uses the unique id's of objects to compare. still that is too much time consuming operation in java.
so i want the better way to compare the objects giving me the high performance.

If you actually tried using a HashMap, and (if necessary) if you correctly implemented certain important methods in your class (this probably wasn't necessary but might have been), and if you used HashMap in a sane way and not an insane way, then you should be getting very fast search times.
So I conclude that one of the following is true:
1) you really didn't try using HashMap.
2) you tried using hashmap, but did so incorrectly (although it's actually pretty simple...)
3) your searches are pretty fast, and any sluggishness you're seeing is caused by something else.
4) your code isn't actually all that sluggish, but you assume it must be for some reason.
Message was edited by:
paulcw

Similar Messages

  • Compare two Java Objects without Comparable / Comparator

    Hi Friends,
    I would like to compare two java objects (lots o attributes) without using Comparable / Comparator.
    Any suggestion/sample code would be helpful.
    Thanks,
    Sachin

    I suppose you could design another feature to compare Objects... but that would involve a design process, so asking for sample code is definitely premature. And as EJP says, what would be the point?
    At least that's what I would answer if this was one of those stupid interview questions.

  • Challenge: Different ways to crash the JVM.

    This is a challenge to find different ways to crash the JVM with code written in Java.
    For starters: Mis-use of the Unsafe class.
    Field field = Unsafe.class.getDeclaredField("theUnsafe");
    field.setAccessible(true);
    Unsafe unsafe = (Unsafe) field.get(null);
    unsafe.getObject(null, 0L); // or many variations on methods in this class.

    Although I presume you mean the latest JVM (6u11), I can reproduce a crash with 1.5.0_05 fairly frequently using the SQL tool "squirrel" ( [http://squirrel-sql.sourceforge.net/]) during startup (while the splash screen is visible):
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #  SIGSEGV (0xb) at pc=0xb7a02c41, pid=9019, tid=2651868080
    # Java VM: Java HotSpot(TM) Server VM (1.5.0_05-b05 mixed mode)
    # Problematic frame:
    # V  [libjvm.so+0x39ec41]The crash is not reproducible on 6u10 (haven't tried it with 6u11), so I don't know how relevant this tidbit actually is but would be glad to check into it with a few other JVMs. For what it's worth, the above happens on RH Enterprise Linux (2.6.9 kernel, smt, Xeon CPU).

  • What are the different ways in accessing the SQL server from NWDS ?

    Hi Experts,
    Can anyone suggest the different ways for accessing the SQL server from NWDS.I also want to know whether any tool is available for accessing SQL server from Webdynpro java application in Netweaver development studio.
    I am currently using JDBC driver for accessing the SQL server from Webdynpro java application in NWDS.
    Regards,
    Krishna Balaji T

    Note - that no internet backup service has been proven to be safe and effective for backing up the iPhoto library - unless you personally have backup uyp an iPhoto library and restored it sucussfuly form one it should not be recommended - a large number of people have lost their photos trying it
    LN

  • How to use the Java objects or methods in pl/sql function as a parameter

    dear all,
    I java object passed as a parameter in pl/sql. how can i access the java objects as parameter in pl/sql function. please give a soultion to me
    mohan reddy

    I'm not sure whether this would help you.
    Have a look at this program to list files from a directory.
    CREATE GLOBAL TEMPORARY TABLE DIR_LIST
    ( FILENAME VARCHAR2(255) )
    ON COMMIT DELETE ROWS
    Table created.
    create or replace
    and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    public static void getList(String directory)
    throws SQLException
    File path = new File( directory );
    String[] list = path.list();
    String element;
    for(int i = 0; i < list.length; i++)
    element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    Java created.
    SQL>
    create or replace
    procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    SQL> exec get_dir_list( 'C:\Bhagat' );
    PL/SQL procedure successfully completed.
    Thanks,
    Bhagat

  • How to retrieve the java object in a proxy service in osb -- Plz help

    Hi all,
    I have a singleton java class which runs whenever the weblogic server gets started and store the output in its object. I need to access this java object from a proxy service in osb.
    We tried using java call out and retrieved that object but we couldn't know how to parse that object into XML.
    We are not sure of using the java call out in osb to solve this purpose because whenever we use a java callout, that particular java code will run which is not the case of singleton class.
    So kindly help us how to retrieve the java object which holds the output without running the java code every time because its already run and holding the output in its object.
    Regards
    Prabhu

    here the doc http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html#wp1106656
    but I guess you are already at the stage of getting a POJO in a first Java Callout and passing the POJO to a second Java Callout, which should then return it to OSB as a XMLObject.
    My recommendation is to write a Java function which returns a XMLObject and uses a XMLCursor to populate it with the values of the POJO.
    An XMLObject returned to the OSB is automatically transformed in a "XML" variable (which in reality is represented as a XMLObject in the Pipeline context)
    Here some code sample:
    http://www.javamonamour.org/2010/09/how-to-create-xmlobject-using-xmlcursor.html

  • How to pass the java object into the spring controller

    Hi Friends
    When I hit the url at the first time my call goes to the spring controller and sets the userDetails objects in the modelAndView.addObject("userDetails", userDetails.getUserDetails()) and returns the userDetails.html page. if I click any link in the same page i want to pass same (userDetails) object thru javascript or jquery and calls the another(controller) method and returns the same (userDetails.html) page.
    It means how can i pass the java object thru javascript or jquery and calls the controller. if i get the same object in my controller i can avoid calling the db again. please help me out to resolve this issue. i am tired of fixing this issue.
    Regards
    Sherin Pooja

    If you want to avoid calling the database again then cache the data.
    However before you do that make sure that calling the database, in the context of YOUR system, is going to be an actual problem.
    For example there is absolutely no point in caching a  User object when only one user an hour is actually using the system.

  • [svn:osmf:] 10124: Add a few variations of HelloWorld, showing the different ways of adding the DisplayObject to the Sprite.

    Revision: 10124
    Author:   [email protected]
    Date:     2009-09-10 10:40:10 -0700 (Thu, 10 Sep 2009)
    Log Message:
    Add a few variations of HelloWorld, showing the different ways of adding the DisplayObject to the Sprite.
    Modified Paths:
        osmf/trunk/apps/samples/framework/HelloWorld/.actionScriptProperties
    Added Paths:
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld4.as
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld5.as
        osmf/trunk/apps/samples/framework/HelloWorld/HelloWorld6.as

    The connections which you have done are right, Here are some settings which you can set on your computer and check if this solves your problem or not.
    Win XP: Click on the Start button >>> go to RUN>> type in "ncpa.cpl"- hit OK >>Here(Network Connections) right click on the ""Local Area Connection"" icon and select properties-Here click on the "Configure"   jaspal button- Click on the "Advanced" tab- In the "Property" box highlight Link speed and duplex/Connection type/Network or Media type- And in the "Value" box select 10 Mbps half duplex/ 10 base T/10 base half mode and click on OK.
    If still you face the same problem, then i feel it might be the problem with the Switch itself. 

  • How can I drop the java objects from a schema

    hi..good afternoon all...
    How can I drop the java objects from a database schema???
    suppose the credentials are scott/tiger@db1
    Another thing is that...I have to do this from cmd(command prompt) as there is no plsql developer or sqldeveloper installed in the machine.
    plss help...thanks in advance...

    hi...i have already tried all the options..but it is showing the error..
    ora:01435 - user does not exist
    but when i have given the command...
    select object type, object_name, status from user_objects where object_type like'%JAVA%';
    then it is showing that the java_object is present....
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    SQL>
    SQL>
    SQL> set linesize 200
    SQL>
    SQL>
    SQL>
    SQL> select object_type, object_name, status from user_objects where object_type
    like '%JAVA%';
    OBJECT_TYPE OBJECT_NAME
    STATUS
    JAVA CLASS javaclass1
    VALID
    JAVA SOURCE javaclass1
    VALID
    SQL> drop java source javaclass1.java;
    drop java source javaclass1.java
    ERROR at line 1:
    ORA-01435: user does not exist
    SQL>

  • Write a SELECT statement in different ways is not the same thing!!!

    Let's take a look
    use AdventureWorks2012
    go
    dbcc freeproccache
    go
    and now select something
    select * from [HumanResources].[vEmployeeDepartmentHistory]
    go
    so, analyzing 'Compiled Plan'
    SELECT usecounts, cacheobjtype, objtype, text
    FROM Sys.dm_exec_cached_plans
    CROSS APPLY sys.dm_exec_sql_text(plan_handle)
    where cacheobjtype = 'Compiled Plan'
    ORDER BY usecounts DESC;
    GO
    and now let's write some SELECT in "fuzzy case"
    dbcc freeproccache
    go
    select * from [HUMANResources].[vEmployeeDepartmentHistory]
    go
    select * from [HumanRESOURCES].[vEmployeeDepartmentHistory]
    go
    select * from [HumanResources].[VEmployeeDepartmentHistory]
    go
    select * from [HumanResources].[vEmployeeDEPARTMENTHistory]
    go
    select * from [HumanResources].[vEmployeeDepartmentHISTORY]
    go
    SELECT * from [HumanResources].[vEmployeeDepartmentHistory]
    go
    select * FROM [HumanResources].[vEmployeeDepartmentHistory]
    go
    and now let's see compiled plans again
    SELECT usecounts, cacheobjtype, objtype, text
    FROM Sys.dm_exec_cached_plans
    CROSS APPLY sys.dm_exec_sql_text(plan_handle)
    where cacheobjtype = 'Compiled Plan'
    ORDER BY usecounts DESC;
    GO
    So, write a SELECT statement in different ways is not the same thing!!!
    Hope it'll be useful
    P.Ceglie

    Yes.  There is little or no query normalization that happens in front of the query plan cache.  It would be a performance tradeoff to parse and normalize the query before matching it to the cached plans.  The benefit of reducing the number
    of plans in the cache probably wouldn't be worth it. 
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Is there a way to compare the contents of a library by comparing itl files or some other files?

    Is there a way to compare the contents of a library by comparing itl files or some other files?
    I need to compare the contents of my current library to one that existed 2 months ago but ALL I have is the itl file from 2 months ago.  Can this be done?

    You are correct, many people have noticed over the years that Sound Check does not work as advertised.
    A more effective approach is to treat the files with a 3rd party volume normalization program. Although I have not personally used it, many users on this Forum have reported good results from an inexpensive program called iVolume.

  • Is there a way to untag the tagged object?

    Is there a way to untag the tagged object in JVMTI ?
    Thanks, David

    In the "Object Tags" subsection of the "Heap" section in the JVM/TI spec:
    Setting a tag to zero makes the object untagged.

  • CSS Acts in different ways according to the logged in user.

    Hi All,
    I have used CSS within my Master Page i.e. Oslo. I have changed the SharePoint 2013s' default Start.aspx file as the new Sites' home page. I also used this CSS code snippet for creating a web menu because SharePoint's default navigation is rather odd. 
    However the menu within the master page was a success and I created several pages using the master page and each new page contains the CSS custom made web menu without any error.
    But when I logged using a different Farm Admin Account the CSS menu changes to a somewhat else. But when I logged in using the built in Administrator account the menu is displayed as it should be. But when I logged in as a different Farm Admin the menu is
    not showing as it should be. I have tried inserting the CSS directly to the Master Page and from the Style Library. Both ways are Ok with the built-in Administrator. But when I logged in using another Farm admin the use of Style Library was a useless thing
    and the direct code input method is was the only success one. The style library has all the permission for all users.
    The source code is at the below.
    <style type="text/css">
    .ms-navedit-editLinksText{
    display: none;
    /*This script part will remove the default SharePoint Navigation & the Site Name Sections **/
    ms-core-navigation {
    display:none
    body{
    width:absolute
    /* This CSS Snippet will style the Web Menu in the MasterPage. */
    /* CSS Document */
    /* =Reset default browser CSS. Based on work by Eric Meyer: http://meyerweb.com/eric/tools/css/reset/index.html
    html,body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, font, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td {
    border: 0;
    font-family: inherit;
    font-size: 100%;
    font-style: inherit;
    font-weight: inherit;
    margin: 0;
    outline: 0;
    padding: 0;
    vertical-align: baseline;
    :focus {/* remember to define focus styles! */
    outline: 0;
    ol, ul {
    list-style: none;
    table {/* tables still need 'cellspacing="0"' in the markup */
    border-collapse: separate;
    border-spacing: 0;
    caption, th, td {
    font-weight: normal;
    text-align: left;
    blockquote:before, blockquote:after,
    q:before, q:after {
    content: "";
    blockquote, q {
    quotes: "" "";
    a img {
    border: 0;
    article, aside, details, figcaption, figure,
    footer, header, hgroup, menu, nav, section {
    display: block;
    .clear {
    clear: both;
    h1 {
    font-size: 18px;
    h2 {
    font-size: 16px;
    /* Lay out design */
    /************** start menu design *************/
    #mainMenu {
    width: relative;
    height: 80px;
    background: url(http://pc/PublishingImages/SitePages/Home/menu-bg.png) repeat-x;
    #main-Menu ul {
    padding-left:10px;
    #main-Menu ul li{
    top: 20px;
    background-color: #4e34ee;
    float: left;
    display: block;
    text-align: center;
    margin-left: 5px;
    -moz-border-radius: 0px;
    -webkit-border-radius: 4px 4px 0px 0px;
    border-radius: 4px 4px 0px 0px;
    /* Tab Content - menucool.com */
    ul.tabs
    padding: 7px 0;
    font-size: 0;
    margin:0;
    list-style-type: none;
    text-align: center; /*set to left, center, or right to align the tabs as desired*/
    ul.tabs li
    display: inline;
    margin: 0;
    margin-right:7px; /*distance between tabs*/
    ul.tabs li a.tab1
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x;*/
    background-color:#0072c6;
    border-radius: 4px 4px 0 0;
    outline:none;
    text-align:center;
    ul.tabs li a.tab2
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#00aa9e;
    border-radius: 6px 6px 0 0;
    outline:none;
    ul.tabs li a.tab3
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#00adc6;
    border-radius: 6px 6px 0 0;
    outline:none;
    ul.tabs li a.tab4
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#00adc6;
    border-radius: 6px 6px 0 0;
    outline:none;
    ul.tabs li a.tab5
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#0072c6;
    border-radius: 4px 4px 0 0;
    outline:none;
    ul.tabs li a.tab6
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#00aa9e;
    border-radius: 6px 6px 0 0;
    outline:none;
    ul.tabs li a.tab7
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#8dc63b;
    border-radius: 6px 6px 0 0;
    outline:none;
    ul.tabs li a.tab8
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#ab23cd;
    border-radius: 6px 6px 0 0;
    outline:none;
    ul.tabs li a.tab9
    font: normal 15px Calibri;
    text-decoration: none;
    padding: 16px 16px;
    border: 0px solid #CCC;
    border-bottom-color:#B7B7B7;
    color: #000;
    /*background: #F0F0F0 url(http://pc/PublishingImages/SitePages/Home/menu-sep.png) 0 0 repeat-x; */
    background-color:#00adc6;
    border-radius: 4px 4px 0 0;
    outline:none;
    ul.tabs li a:visited
    color: #000;
    ul.tabs li a:hover
    border: 1px solid #B7B7B7;
    background:gray 0 -36px repeat-x;
    ul.tabs li.selected a, ul.tabs li.selected a:hover
    top: 0px;
    font-weight:bold;
    border: 1px solid #B7B7B7;
    border-bottom-color: white;
    ul.tabs li.selected a:hover
    text-decoration: none;
    #sub1{ background: #e3d0e6; }
    #sub2{ background: #00adef; }
    #sub3{ background: #8dc63b; }
    #sub4{ background: #8dc63b; }
    /************** end menu design *************/
    </style>
    The web menu is at the below.
    <!------ Web Menu ------>
    <div id="mainMenu">
    <ul class="tabs" data-persist="true">
    <li><a href="http://pc/SitePages/Home.aspx" class="tab1"><b>HOME</b></a></li>
    <li><a href="http://pc/Pages/IT-Help-Desk.aspx" class="tab2"><b>IT HELP DESK</b></a></li>
    <li><a href="http://pc/Pages/Electronic-Forms.aspx" class="tab3"><b>ELECTRONIC FORMS</b></a></li>
    <li><a href="http://pc/Pages/Contacts.aspx" class="tab4"><b>CONTACTS</b></a></li>
    <li><a href="http://pc/Budget/Forms/AllItems.aspx" class="tab5"><b>DOCUMENTS STORAGE</b></a></li>
    <li><a href="http://pc/Pages/Image-Library.aspx" class="tab6"><b>IMAGE LIBRARY</b></a></li>
    </ul>
    </div>
    <!------ End of Web Menu ------>
    I cannot figure the error I am facing. Could someone help me to solve this matter ?
    Thank You,
    Regards,
    Chiranthaka

    I haven't seen this issue before. What I would do is, log in as each user then view the source of the page in the browser (right click the page and click "View Page Source" from the context menu, or use developer tools/firebug in the browser). Compare
    the HTML generated for the menu for each user and see if any other CSS classes get applied. My gut is that another class is being applied for the other users, or the HTML is different in some way.
    Brandon Atkinson
    Blog: http://sharepointbrandon.com

  • Correct way to handle the updated object

    Hi,
    I have a thread, test2.java, that periodically update a object that pass from test.java. In test.java, the "data" object need to be most updated coz this object is used in other thread also. I can ensure that only test2.java do the write, others threads are read only.
    My question is: I can write some dirty code to do what I want. But for a programmer, I want to know the formal, oo way to handle this situation.
    Thanks.
    Tommy
    public class test{
    data d;
    test2 t2;
    public test(){
    d = new data(1, getClass().toString());
    t2 = new test2(d);
    t2.start();
    public void runServices(){
    while(true){
    //If i don't do anything, the following code only print out
    //the instance that i init. here.. Not the updated one
    System.out.println(d.toString());
    try{
    Thread.sleep(5000);
    }catch(InterruptedException ex){}
    public static void main(String[] args){
    test t = new test();
    t.runServices();
    * This class will periodically update the "data" object that
    * passed from test.java
    public class test2 extends Thread{
    int count = 1;
    data d;
    public test2(data a){
    this.d = a;
    public void run(){
    while(true){
    d = new data(count++, getClass().toString());
    System.out.println(d.toString());
    try{
    sleep(5000);
    }catch(InterruptedException ex){}
    public class data{
    int count;
    String s = "";
    public data(int a, String b){
    count = a;
    s = b;
    public String toString(){
    return s + " count:" + count;

    Sorry nearly missed that :(
    You should try to modify the instance of data you have been given in the constructor for test2 instead of creating a new object:
    * This class will periodically update the "data" object that
    * passed from test.java
    public class test2 extends Thread {
      int count = 1;
      data d;
      public test2(data a) {
        this.d = a;
      public void run() {
        while(true) {
          d.refreshWith(count++, getClass().toString());
          System.out.println(d.toString());
         try {
           sleep(5000);
         } catch(InterruptedException ex){}
    }

  • Is there a way to find the class objects memory size?

    Hi Friends,
    Please help.
    Is there a way to find the number of Objects created and total size?
    For example:
    class AgeRecord
    int start;
    int end;
    AgeRecord(int start, int end)
    this.start = start;
    this.end = end;
    In a loop if I create 1000 objects, how will I get the total memory size
    Thanks and Regards
    JG

    You might find this useful...
    package forums;
    http://weblogs.java.net/blog/dwalend/archive/2007/11/the_thing_about.html
    http://forums.sun.com/thread.jspa?threadID=457279&start=30&tstart=0
    http://www.velocityreviews.com/forums/t364574-size-of-boolean-type.html
    The JLS doesn't specify the size of a boolean, leaving it upto the JVM
    implementor to define. Sun's JVM stores booleans as:
    (1) a boolean is-an int; i.e. a signed 32 bit twos-compliment integer.
        At face value, this is an innordinate waste of space, but Java uses a
        32-bit stack frame, and most (modern) CPU's use a 32-bit word anyway,
        so the wasted space is worth the CPU cycles, and it's simple.
    (2) a boolean[] is-a byte array, using 1 byte per element, rounded up to the
        nearest 8, plus 8 bytes for the array-object itself.
        For example: boolean[] bools = boolean[100];
        100 mod 8 = 4; so that'd be 104 bytes + 8 bytes = 112 bytes.
        So, let's dis/prove the contention by experiment.
        1,000,000 mod 8 = 0 so 1,000,000 + 8 bytes for the array = 1,000,008
    class BooleanArraySizeTest
      public static void main(String[] args) {
        final Runtime rt = Runtime.getRuntime();
        System.out.println("The contention is that each iteration should use 1,000,008 bytes.");
        try {
          long before, after;
          final int TIMES = 32;
          boolean[][] bools = new boolean[TIMES][];
          for (int i=0; i<TIMES; i++) {
            before = rt.totalMemory() - rt.freeMemory();
            int n = 1000*1000-(TIMES/2)+i;
            bools[i] = new boolean[n];
            after = rt.totalMemory() - rt.freeMemory();
            System.out.print(n);
            System.out.print('\t');
            System.out.print(after-before);
            System.out.println();
        } catch (Exception e) {
          e.printStackTrace();
    999984 used=1000000 bytes
    999985 used=1000000 bytes
    999986 used=1000000 bytes
    999987 used=1000000 bytes
    999988 used=1000000 bytes
    999989 used=1000008 bytes
    999990 used=1000008 bytes
    999991 used=1000008 bytes
    999992 used=1000008 bytes
    999993 used=1000008 bytes
    999994 used=1000008 bytes
    999995 used=1000008 bytes
    999996 used=1000008 bytes
    999997 used=1000016 bytes
    999998 used=1000016 bytes
    999999 used=1000016 bytes
    1000000 used=1000016 bytes
    1000001 used=1000016 bytes
    1000002 used=1000016 bytes
    1000003 used=1000016 bytes
    1000004 used=1000016 bytes
    1000005 used=1000024 bytes
    1000006 used=1000024 bytes
    1000007 used=1000024 bytes
    1000008 used=1000024 bytes
    1000009 used=1000024 bytes
    1000010 used=1000024 bytes
    1000011 used=1000024 bytes
    1000012 used=1000024 bytes
    1000013 used=1000032 bytes
    1000014 used=1000032 bytes
    1000015 used=1000032 bytes
    ENVIRONMENT:
      Microsoft Windows [Version 6.0.6000]
      Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
      C:\Users\Administrator>java -version
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)
    */Cheers. Keith.

Maybe you are looking for