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 8991529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:44:56+00:00 2026-06-15T22:44:56+00:00

Sir I have a problem.I find the binary of a negative number that gives

  • 0

Sir I have a problem.I find the binary of a negative number that gives me in 32 bits.I trim all other bits except the first 8 bits.Now I change LSB of it.It gives me 125 as answer. I have to embed this in an gray scale image. According to my requirement , I have to add this 125 in mean(sum of four neighbouring pixels) .When i add this to mean.I gives me answer that exceeds 255. So is it posible that after modifing lsb. my bit remain negative.

here is my code

string str1 = Convert.ToString(d[1, 1], 2);
str1 = str1.Substring(Math.Max(str1.Length - 8, 0)).PadLeft(8, '0');
char[] data = new char[str1.Length]; 

for (int m = 0; m < str1.Length; m++)
{
    data[m] = str1[m];
}

//data[0] = '0';
string s="";
data[0] = '0';

for (int m = 0; m < str1.Length; m++)
{
    s += data[m];
}

byte output = Convert.ToByte(s, 2);
  • 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-15T22:44:57+00:00Added an answer on June 15, 2026 at 10:44 pm

    Your code is trimming all but the last 8 bits. If you want to trim all but the first 8 bits, you should use str1.Substring(0, 8). And you are changing the MSB of the last 8 bits. if you want to change the LSB, you should use data[7] instead of data[0].

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

Sidebar

Related Questions

sir i have working with db connectivity i have written all code and i
Respected Sir! As i have not learnt java yet but most people say that
Sir, i am working in a java application.On that application i have to access
Respected sir/madam, I have a fortran exe which takes a input file and produces
Sir, I am having some problem regarding database in SQL Server. My project is
Hello sir i send the arraylist through url pass from android to php all
Here's a simplified version of a problem I'm working on: I have a bunch
I can't seem to find the function that gets called after the editurl:url has
$(.menu-container).animate({top:25px}); $(.menu-container).animate({top:-900px}); $(.windows-container).animate({top:-730px}); hello sir.. i got a problem on queue in jquery.. what
I have this cod: [Serializable] public class testC { string sir; public testC() {

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.