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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:43:06+00:00 2026-05-21T10:43:06+00:00

I couldn’t find anything on that while googling so I want to create an

  • 0

I couldn’t find anything on that while googling
so
I want to create an array only if it doesn’t already exists.

EDIT: I mean not initialized

I know how to check for values in the array

Should be simple but I’m stuck

best regards

static long f(long n) {
    int m = (int)n;
    **if (serie == null) {

   long[] serie = new long[40];
    }**
    if (n == 0) {
        return 0;
    }
    else if (n==1) {
        return 1;
    }
    else {
        long asdf = f(n-1)- 2*(f(n-2)) + n;
        return asdf;
    }
}

something like that
a recursive function and I want to save the values in an array

  • 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-21T10:43:06+00:00Added an answer on May 21, 2026 at 10:43 am

    Are you looking for:

    if (values == null)
    {
        values = new int[10];
    }
    

    or something like that? If not, please edit your question to provide more information.

    EDIT: Okay, judging by the updated question, I suspect you ought to have two methods:

    static long f(long n)
    {
        return f(n, new long[40]);
    }
    
    static long f(long n, long[] serie)
    {
        // Code as before, but when you recurse, pass in serie as well
    }
    

    (Note that your current code doesn’t use serie at all.)

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

Sidebar

Related Questions

Couldn't find anything really useful for my needs. So if I already know my
Couldn't find any related resources I want to add a custom property to my
I couldn't find a better title to describe my problem. I want to achieve
I couldn't find anything about getting the total JSON record count using jQuery. Here
Couldn't find a trace of the source code behind the Photos application that runs
Couldn't find anything on this with a Google Search. Does anyone know how to
Couldn't find anything related to the subject in Zend Framework API. What is the
Couldn't find anything relevant in forums So ,Please help me with this code .I'm
I couldn't find any documentation about this... I want to write to a file
I couldn't find the answer to this in any other question. Suppose that I

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.