Changeset 1585

Show
Ignore:
Timestamp:
12/11/09 08:58:19 (2 years ago)
Author:
amandel
Message:

Fix array size = 0 case

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/java/org/jcoderz/commons/util/ArraysUtil.java

    r1583 r1585  
    278278    } 
    279279 
    280     private static void appendArray( 
     280    private static void appendArray ( 
    281281        StringBuffer buf, Object array, int maxSize) 
    282282    { 
     
    292292        { 
    293293            final int length = Array.getLength(array); 
     294            buf.append('['); 
    294295            for (int i = 0; i < length; i++) 
    295296            { 
    296                 if (i == 0) 
     297                if (i != 0) 
    297298                { 
    298                     buf.append('['); 
    299                 } 
    300                 else if (i == maxSize) 
    301                 { 
    302                     buf.append(",... in total "); 
    303                     buf.append(length); 
    304                     buf.append(" Elements"); 
    305                     break; 
    306                 } 
    307                 else 
    308                 { 
     299                    if (i == maxSize) 
     300                    { 
     301                        buf.append(",... in total "); 
     302                        buf.append(length); 
     303                        buf.append(" Elements"); 
     304                        break; 
     305                    } 
    309306                    buf.append(", "); 
    310307                }