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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:37:20+00:00 2026-05-14T16:37:20+00:00

I am using on the client C# where I am converting double values to

  • 0

I am using on the client C# where I am converting double values to byte array.

I am using java on the server and I am using writeDouble and readDouble to convert double values to byte arrays.

The problem is the double values from java at the end are not the double values at the begin giving to c#

writeDouble in Java Converts the double argument to a long using the doubleToLongBits method , and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first.

DoubleToLongBits Returns a representation of the specified floating-point value according to the IEEE 754 floating-point “double format” bit layout.

The Program on the server is waiting of 64-102-112-0-0-0-0-0 from C# to convert it to 1700.0 but he si becoming 0000014415464 from c# after c# converted 1700.0

this is my code in c#:

 class User
  {
    double workingStatus;
public void persist()
   {
     byte[] dataByte;
   using (MemoryStream ms = new MemoryStream())
     {
       using (BinaryWriter bw = new BinaryWriter(ms))
       {

         bw.Write(workingStatus);
         bw.Flush();
         bw.Close();
       }

    dataByte = ms.ToArray();

       for (int j = 0; j < dataByte.Length; j++)
       {

         Console.Write(dataByte[j]);
       }
}
public double WorkingStatus
      {
     get { return workingStatus; }
     set { workingStatus = value; }
      }

}
class Test
{
  static void Main()
  {
    User user = new User();
     user.WorkingStatus = 1700.0;
     user.persist();
  }

thank you for the 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-05-14T16:37:21+00:00Added an answer on May 14, 2026 at 4:37 pm

    If the Endianess does not match between the Systems you will have to reverse it. For Double there are no built-in methods in .Net. So you have to do it yourself:

    Array.Reverse(dataByte);
    doubleValue = BitConverter.ToDouble(dataByte);
    

    BitConverter also has a IsLittleEndian property that you can use to check if you really have different endianess.

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

Sidebar

Ask A Question

Stats

  • Questions 435k
  • Answers 435k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's displayed in the "Autos" window. Debug/Windows/Autos At least for… May 15, 2026 at 3:36 pm
  • Editorial Team
    Editorial Team added an answer I'd pass the parent to the MyTimer class in the… May 15, 2026 at 3:36 pm
  • Editorial Team
    Editorial Team added an answer Try this printf (C, Perl, PHP) format string: "%07.2f" May 15, 2026 at 3:36 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.