Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
Challenge to new programmers!
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 10-04-2011, 05:11 AM
Xeox's Avatar
Forum Addict
$25 USD Donor
 
Join Date: Jun 2010
Location: Watertown, CT
Posts: 346
Send a message via MSN to Xeox
Cards Challenge to new programmers!

Make a program that prints out the binary representation of an integer. Does not have to deal with negatives. I will post my way of solving this in a week, maybe sooner. Oh and no it's not a homework assignment of mine!
__________________
Reply With Quote
  #2  
Old 10-04-2011, 05:19 AM
Jimmy's Avatar
Leecher
Ex-Moderator $5 USD Donor
 
Join Date: Jun 2008
Location: Southern California
Posts: 2,359
Default Re: Challenge to new programmers!

http://download.oracle.com/javase/7/...naryString(int)

?
Reply With Quote
  #3  
Old 10-04-2011, 05:20 AM
Guru
 
Join Date: Jun 2005
Location: Canada
Posts: 1,844
Default Re: Challenge to new programmers!

I think the point of this is to write your own algorithm that converts an integer to binary :P
__________________

Reply With Quote
  #4  
Old 10-04-2011, 05:39 AM
Xeox's Avatar
Forum Addict
$25 USD Donor
 
Join Date: Jun 2010
Location: Watertown, CT
Posts: 346
Send a message via MSN to Xeox
Default Re: Challenge to new programmers!

Quote:
Originally Posted by blindkilla View Post
I think the point of this is to write your own algorithm that converts an integer to binary :P
Yea, it was a practice question for my first College CS exam, and I just thought it would liven things up a bit in the Java forum.
__________________
Reply With Quote
  #5  
Old 10-07-2011, 12:13 AM
Forum Addict
 
Join Date: Apr 2011
Posts: 487
Default Re: Challenge to new programmers!

I will try this one day that I have some experience. I'm starting programming this week, but nto sure what language to start on.
Reply With Quote
  #6  
Old 10-26-2011, 08:57 AM
Active Member
 
Join Date: Feb 2011
Posts: 132
Default Re: Challenge to new programmers!

didn't realize you could directly convert integers to hex, octal and binary so easily
Reply With Quote
  #7  
Old 11-10-2011, 10:53 PM
Govind's Avatar
Hero
Highly Respected Highly Trusted Sythe Verified User
 
Join Date: Apr 2005
Posts: 7,068
Default Re: Challenge to new programmers!

Code:
public void intbin(int input)
{
    int i;
    for(i = 0; i < 32; i++)
    {
        System.out.print(( input >> 31)&1);
        input <<= 1;
    }
    System.out.print("\n");
}
whadu i win
Reply With Quote
  #8  
Old 01-10-2012, 02:39 AM
Newcomer
 
Join Date: Jan 2012
Posts: 2
Default Re: Challenge to new programmers!

import javax.swing.*;
public class DecToBin{
public static void main(String [] args){
int numDec=0
String numBin="";
numDec=Integer.parseInt(JOptionPane.showInputDialo g("Enter a number:"));
while(numDec>=1)
{
if(numDec==1){
numBin="1"+numBin; break;
}
else{
if(numDec%2==0)
{ numBin="0"+numBin;numDec/=2;}
else
{ numBin="1"+numBin;numDec/=2;}
}
}
JOptionPane.showMessageDialog(null,"Binary Number:"+numBin);
System.exit(0);
}
}
//i hope that this will work

Last edited by hell016 : 01-10-2012 at 02:39 AM.
Reply With Quote
  #9  
Old 01-10-2012, 11:51 PM
Member
 
Join Date: Dec 2011
Posts: 69
Default Re: Challenge to new programmers!

There are two binary representations, a mathematical and a computational.

where 000... is -2,147,000,000 or something in computational
and on a mathematical base 32 zeros would be 2^32.
Which one are you referring to?
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 11:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1