usr/src/java/util/org/opensolaris/os/vp/util/misc/MathUtil.java
changeset 685 767674b0a2fb
parent 219 57841c113efe
equal deleted inserted replaced
684:f7b1d1fbdb8e 685:767674b0a2fb
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 
    21 
    22 /*
    22 /*
    23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    23  * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
    24  * Use is subject to license terms.
       
    25  */
    24  */
    26 
    25 
    27 package org.opensolaris.os.vp.util.misc;
    26 package org.opensolaris.os.vp.util.misc;
    28 
    27 
    29 public class MathUtil {
    28 public class MathUtil {
    50 	}
    49 	}
    51 	return max;
    50 	return max;
    52     }
    51     }
    53 
    52 
    54     public static String toBinary(long l, int bits) {
    53     public static String toBinary(long l, int bits) {
    55 	StringBuffer buffer = new StringBuffer(bits);
    54 	StringBuilder buffer = new StringBuilder(bits);
    56 
    55 
    57 	for (int i = 0; i < bits; i++) {
    56 	for (int i = 0; i < bits; i++) {
    58 	    buffer.insert(0, l & 1);
    57 	    buffer.insert(0, l & 1);
    59 	    l >>>= 1;
    58 	    l >>>= 1;
    60 	}
    59 	}