Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java Program to keep track of a list of Static IP Addresses

Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all-

Basically, I have a bunch of static IP addresses. I have an array filled with the last 3 digits of each address (the first 9 numbers are all the same of the address), and I am going to compare that array to another array filled with the numbers 1 -- 255. (Eventually, I hope to store the IP's being used in a text file rather than an array.) Anyways, those two arrays are compared and the IP's not already in the original array will be put into a new one.

I know, this is confusing, but please look at the code, its alot simpler.

Everything compiles, and it is almost running correctly, but not quite. When I print out arrey_New (the array which holds the addresses NOT in use), it seems to print out a duplicate of array_Sample (containing 1 -- 255). Here is what my output looks like:

The outputted number of addresses in use (37) is correct, but the addresses available is waaay to high, it should be 255-37 (=218).

Does anyone have any suggestions? Thanks!
lowercase baba
Posts: 12893
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this forum is for talking about the javaranch itself - it's polices, how people act, etc.

we're going to move your post shortly to a more appropriate forum.
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe consider using the List interface? It has some helpful methods.

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic