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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:53:54+00:00 2026-06-02T05:53:54+00:00

This is probably a question with a blindingly obvious answer. I just can’t see

  • 0

This is probably a question with a blindingly obvious answer. I just can’t see it, and will probably feel very small when someone points it out to me clearly.

I’m using Android at the Eclair MR1 level, so my Android Manifest has:

<uses-sdk android:minSdkVersion="7" />

In my MainActivity, I have a byte[] that I want to realloc to a larger size.

Java SE 6 has the java.util.Arrays class with static methods to do that for every elementary type. I can see that class documented in the android docs at http://developer.android.com/reference/java/util/Arrays.html#copyOf%28byte%5B%5D,%20int%29

Here’s my code:

    byte [] padToLength (byte[] plain) {

    try{
        byte[] plainpad2 = java.util.Arrays.copyOf(plain, plain.length+10);  //why won't this compile?
    } catch (Exception e) {

    }

But when I use that, I get a compilation error in Eclipse, saying “the method copyOf(byte[], int) is undefined for the type Arrays.

Can anyone suggest what I am doing wrong?

  • 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-02T05:53:55+00:00Added an answer on June 2, 2026 at 5:53 am

    Arrays.copyOf(byte[], int) is not defined for API Level 7. At that link you provided, have a look in the top-right corner and you’ll see a checkbox that says “Filter By API Level”. Selecting 7 removes that method.

    Why are you working with arrays anyway? In Java you should almost always use ArrayList unless you are experiencing performance problems. In that case, you don’t have to worry about the size of your array at all. If your function must accept a byte[] parameter, then I’d suggest invoking something like List<Byte> myList = Arrays.asList(plain).

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

Sidebar

Related Questions

All, This question probably has a very simple answer - something I'm overlooking. But
This is probably a question that has an easy/simple/obvious answer, but I've found myself
This is probably an easy question to answer, but I don't see it mentioned
This is probably a simple question but I can't seem to find the solution.
This question probably has no definite answer, so if it's considered subjective and, let's
I'm very new to Java programming language so this is probably dumb question but
I'm a jstl newbie so probably this question will sound to you funny. Anyway,
This probably comes across as a very naive question, and I am absolutely assuming
I'm sorry for this ( probably very ) noob question, but i've been asked
this question probably wont be explained very well and that's because I don't really

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.