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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:50:50+00:00 2026-06-07T07:50:50+00:00

I am trying to write a distributed application in Java, however the program I

  • 0

I am trying to write a distributed application in Java, however the program I am writing is replacing a VB6 equivalent. The data files that are used are live files containing binary data written using VB6 put methods and are constantly in use by several applications.

I have successfully retrieved text from the file by reading an entire record (160 bytes) into the byte array buf. Then using the following line to extract text fields

new String(Arrays.copyOfRange(buf, 15, 40), "ISO-8859-1");

I also need to extract the VB6 data types Boolean, Double, Integer, Long and Single. Eventually I will probably need datetime as well but not for the first stage. To do doubles I know that the endianess is Little endian rather than big in VB6 so I have the following function

public static double toDouble(byte[] bytes) {
    return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getDouble();
}

The first few data fields are strings then 2 double, the output at the moment is:

Barcode: 1            
Dept Code: 18
Description: MISC NON VAT             
Trade Price: 0.0
Retail Price: 0.009999999776482582

As you can see the first 3 are logical and match the content in the datafile. The trade price should be 0.0 so that is fine but retail price should be 0.01 which would be correct if I round it but, A. I am uncomfortable rounding price and vat info and B. I can’t reasonably write any changes back to the file as if I am reading with a margin or error then I will probably be writing with the same margin of error. I also tried manually bit-shifting but for a double Java complains if I try and shift more than 31 bits which of course I need to in order to do 56.

Any help on this would be much appreciated

  • 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-07T07:50:52+00:00Added an answer on June 7, 2026 at 7:50 am

    If I were trying to do this, I think I’d write a VB6StreamReader that encapsulates the reading of VB6 primitives and deals with the quirks in the data that result from in the way the data is written via Put in VB6.

    In regards to rounding, most floating point numbers are represented in the way you described. Are you concerned that VB6 encodes floating point numbers in a non-standard way? Visual Basic uses the IEEE 754.


    Useful IEEE-754 calculator: http://babbage.cs.qc.cuny.edu/IEEE-754/

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

Sidebar

Related Questions

I'm trying write a java program to send live microphone data over UDP, then
I am trying write a function that generates simulated data but if the simulated
I'm running a java application that we distribute as a server-side system. I'm trying
I'm trying write a C program that sends an UDP packet to a given
I'm trying write a test for a method that returns a java.sql.Connection to connect
I m trying write code that after reset set up rrpmax as 3000. It
Trying to write app for service technicians that will display open service calls within
Trying to write a couple of functions that will encrypt or decrypt a file
Trying to write a code at the moment that basically tests to see if
I'm trying to distribute this app that I wrote in python. The application consists

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.