I recently posted a question about this, but was not really sure where to go. I've gotten some progress, and have generated some simple noise here:


That works well enough for me, but I would really like to be able to save the points into an ascii text file. currently it's formatted so that something like this:





would create a square. I need to save in this format with the points(and lines connecting them) generated in the method above.

Essentially, I need to write the array of points created in the first example to a text file formatted like the second example. EDIT: I ended up using serialization. This method makes it un-editable, but works for my purposes, I can really have good terrain generation now. here's my code: http://pastie.org/5455624 Everything is working excellently. Thanks to all those who helped

  • \$\begingroup\$ Your question, if I'm interpreting it correctly, is: "how do I write a text file from Java?" Is that correct? \$\endgroup\$ Nov 21, 2012 at 4:20
  • \$\begingroup\$ No, not exactly. I need to write an array of points into a text file in the format used in my example. Edited for clarity. \$\endgroup\$
    – Dylan Katz
    Nov 21, 2012 at 4:28
  • \$\begingroup\$ How do your points look like then? I mean, do you have Java classes for them? Maybe a bit code would help. \$\endgroup\$
    – Markus
    Nov 21, 2012 at 7:47
  • \$\begingroup\$ What do you mean? I put the code in the post. The class "Point" is built in to java. \$\endgroup\$
    – Dylan Katz
    Nov 21, 2012 at 20:50
  • \$\begingroup\$ Paste your solution as an answer and accept it. Maybe someone can make use of it later. \$\endgroup\$
    – Anko
    Dec 9, 2012 at 1:06

1 Answer 1


You could consider Serialization



  1. Hides your values
  2. Easier to save/load


  1. Values can not be modified in text editor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .