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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:27:33+00:00 2026-05-24T10:27:33+00:00

I want to dump one Double array and two Long arrays into a bytebuffer.

  • 0

I want to dump one Double array and two Long arrays into a bytebuffer. I could use a loop and do

double[] arr1 = new double[size];
long[] arr2 = new long[size];
long[] arr3 = new long[size];
for(int i=0;i<size;i++){
    buffer.putDouble(arr1[i]);
    buffer.putLong(arr2[i]);
    buffer.putLong(arr3[i]);
}

This doesn’t seem efficient. Is there a way to balk dump them?

  • 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-24T10:27:34+00:00Added an answer on May 24, 2026 at 10:27 am

    If you truly want to “bulk dump” the data, rather than interleave it in some application-dependent manner, then you can create LongBuffer and DoubleBuffer views into your ByteBuffer. The general procedure is as follows:

    1. Call position() to set the position of the buffer to wherever you want to store the array (you’ll have to calculate this based on the size of the primitives).
    2. Call slice() on the buffer to create a new buffer that shares the backing store but is offset.
    3. Call asLongBuffer() or asDouble() buffer on the new buffer.
    4. Call the bulk put() method on the buffer created in step 3.

    This process is a convenience, not a performance enhancement. Unless you’re talking tens of millions of elements, you’re unlikely to see any improvement at all, and even then you’re probably looking at microseconds.

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

Sidebar

Related Questions

I have two databases. I want to dump data from one table in 1st
I don't want to use the HTTP::Proxy package because I want to dump out
I want to import an oracle dump into a different tablespace. I have a
I want to reverse engineer (import into diagram form) the database definition dump of
Arrays seem to be one of those subjects that just doesn't want to click
I want to dump some requests (of type javax.servlet.http.HttpServletRequest ) into a file and
$arr = array('one' => array('one_1' => array('one_2' => '12')), 'two', 'three'); $arr2 = array('one_2'
Seeing lots of SOAP/RDS stuff, but just want to dump some MySQL data and/or
I want a C program to produce a core dump under certain circumstances. This
I want to retrieve stack trace from a user dump file programmatically . There

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.