Java Type Size sizeOfBinary(int maximumNumber)

Here you can find the source of sizeOfBinary(int maximumNumber)

Description

size Of Binary

License

Apache License

Declaration

public static int sizeOfBinary(int maximumNumber) 

Method Source Code

//package com.java2s;
/* Copyright 2012 Cameron Cook
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.//from   ww w.  j  ava 2  s.  c  om
 *
 */

public class Main {
    public static int sizeOfBinary(int maximumNumber) {
        return (Long.toBinaryString((long) maximumNumber) + "").length();
    }
}

Related

  1. sizeOf(int value)
  2. sizeOf(int[] arr)
  3. sizeOf(String str)
  4. sizeOf(String type)
  5. sizeOf(String typeDescriptor)
  6. sizeOfCompactInt(int i)
  7. sizeOfEnumValue(T enumValue)
  8. sizeOfFloat(float f)
  9. sizeOfInt()