• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe consider using the List interface? It has some helpful methods.

 
reply
    Bookmark Topic Watch Topic
  • New Topic