bruins301's Profile User Rating: -----

Reputation: 1 Apprentice
New Members
Active Posts:
16 (0.02 per day)
15-November 12
Profile Views:
Last Active:
User is offline Oct 16 2013 12:45 PM

Previous Fields

Dream Kudos:
Icon   bruins301 has not set their status

Posts I've Made

  1. In Topic: Making Binary Conversion class

    Posted 9 Sep 2013

    I fixed my problem it turns out the class never let my binary number exit the loop in the sizeOf() method. My power variable in binaryConversion also kept initializing to zero everytime the loop ran. Other than that my code was good this is my new code. Anyone is welcome to use this code if they wish. :bananaman: :gun_bandana:
    public class BinaryConverter {
    	// instance Variable of binary data
    	private int binaryNumber;
    	private int row;
    	// Constructor :: Constructor
    	public BinaryConverter(int number) {
    		binaryNumber = number;
    	// Array Row & Column Setters
    	public void setRow(int row) {
    		this.row = row;
    	public int sizeOf(int number) {
    		int count = 0;
    		while (number > 0) {
    			number /= 10;
    		return count;
    	public int binaryConversion(int binaryNumber) {
    		int binary[] = new int[row];
    		int powerOperator = 0;
    		int sumOperator = 0;
    		int mod = 10;
    		for (int j = 0; j < binary.length; j++) {
    			// System.out.print(j);
    			binary[j] = binaryNumber % mod;
    			System.out.println("binary array : " + binary[j]);
    			binaryNumber /= 10;
    		int power = 0;
    		for (int i = 0; i < binary.length; i++) {
    			powerOperator = (int) (binary[i] * Math.pow(2, power));
    			sumOperator += powerOperator;
    		return sumOperator;
  2. In Topic: Making Binary Conversion class

    Posted 7 Sep 2013

    The problem is when I type in lets say 01010010
    The computer does not read in the number. My method sizeOf(binarynumber) within my BinaryConversion class is not able to count the amount of digits there are in the number. This causes the columns in my array no opportunity to initialize to either a 0 or 1. Then the program does not terminate at all. Although i just realized i should remove line 45 of the class BinaryCoversion. Other then that I do not see any other errors in my program. But I am still new to programming so any advice would be helpful. If you wish to delete this topic all together that's fine with me too I guess i'll be able to figure it out myself eventually.

    public class TestBinaryConverter {
    	public static void main(String[] args) {
    		int binaryNumber = 0;
    		Scanner wiz = new Scanner (;
    		System.out.print("Welcome to Binary Converter v.1.0\n");
    		System.out.print("Enter your Binary Integers: ");
    		binaryNumber = wiz.nextInt();
    		BinaryConverter binary1 = new BinaryConverter(binaryNumber);
    		int numberOfInts = binary1.sizeOf(binaryNumber);
    		System.out.print(binaryNumber + "\n");
    		int decimalNumber = binary1.binaryConversion(binaryNumber);
    		System.out.print("Your Decimal Number is " + decimalNumber);
  3. In Topic: Making Binary Conversion class

    Posted 7 Sep 2013

    yes it is my code and I do realize there is no main method. But i would like to apologize for the inconvience of my tired eyes i've been typing this class for awhile. The programs intended purpose is taking a binary number lets say 00001001 and change it to a base 10 number.would you like to see the main method?
  4. In Topic: Making Binary Conversion class

    Posted 7 Sep 2013

    just realized this is the wrong section to post code
  5. In Topic: There is a problem with my source code it continually return the same#

    Posted 4 Sep 2013

    Thank you for your assistance I will implement all of your ideas for v.1.1 of my program. You guys the best, I aspire to think as pragmatically as this forum one day. By the way my program works now :gunsmilie: !

My Information

Member Title:
New D.I.C Head
Age Unknown
Birthday Unknown

Contact Information



bruins301 hasn't added any friends yet.


bruins301 has no profile comments yet. Why not say hello?