Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:38:17+00:00 2026-06-09T12:38:17+00:00

I have a question about getting a Bitmap from a character, for example A.

  • 0

I have a question about getting a Bitmap from a character, for example A.

I was already searching in the internet but no direct help. I found this page, where my plans are described.

Quotation from this site:

e.g. character char=”A” bits=”227873781661662″ which translates to “0000 0000 0000 0000 1100 1111 0011 1111 1111 1111 1100 1111 0011 1111 1101 1110” in binary.

How do they get from 227873781661662 to 0000 0000 0000 0000 1100 1111 0011 1111 1111 1111 1100 1111 0011 1111 1101 1110?

int num = 227873781661662;
int n = log(num)/log(2)+1;          //Figure out the maximum power of 2 needed
NSString *result = @"";             //Empty string
for (int j=n; j>=0; j--)            //Iterate down through the powers of 2
{
    if (pow(2,j) >= num)            //If the number is greater than current power of 2
    {
        num -= pow(2,j);                             //Subtract the power of 2
        result = [result stringByAppendingString:@"1"]; //Add a 1 to result string
    }
    else result = [result stringByAppendingString:@"0"]; //Otherwise add a 0

    if (num == 0) break;                              //If we're at 0, stop
}
NSLog(@"num = %i",num);

What is wrong with this? Thanks for help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:38:19+00:00Added an answer on June 9, 2026 at 12:38 pm

    To convert a number from decimal to binary:

    long long num = 938409238409283409;
    int n = log(num)/log(2)+1;          //Figure out the maximum power of 2 needed
    NSString *result = @"";             //Start with empty string
    for (int j=n; j>=0; j--)            //Iterate down through the powers of 2
    {
        long long curPOW = powl(2,j);
        if (curPOW <= num)          //If the number is greater than current power of 2
        {
            num -= curPOW;                                  //Subtract the power of 2
            result = [result stringByAppendingString:@"1"]; //Add a 1 to result string
        }
        else result = [result stringByAppendingString:@"0"]; //Otherwise add a 0
    }
    NSLog(@"%@", result); //Result is now binary representation of num
    

    With the example num above output is:
    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a similar question about getting just the rotation, but as I understand
I have a quick question about getting the value from control which I added
I have a question about splitting string in javascript. I'm getting a string from
I have a question about getting information from a MySQL database. The context is
I have a question about getting DLL's directory on Windows system. The situation is
I have seen this question that talks about getting the last part of a
I am just getting into Sharepoint, and I have a question about having a
I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The
I have a question about how InstanceScope.Singleton works, because I am getting some unexpected
I'm just getting used to Subversion and I have a fundamental question about versioning.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.