Array Fill Test : Arrays « Collections Data Structure « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Collections Data Structure » ArraysScreenshots 
Array Fill Test
Array Fill Test
 

import java.util.*;
public class FillTest {
  public static void main(String args[]) {
    int array[] new int[10];
    Arrays.fill(array, 100);
    for (int i=0, n=array.length; i<n; i++) {
      System.out.println(array[i]);
    }
    System.out.println();
    Arrays.fill(array, 3650);
    for (int i=0, n=array.length; i<n; i++) {
      System.out.println(array[i]);
    }
    byte array2[] new byte[10];
    Arrays.fill(array2, (byte)4);

    System.out.println();
    Date array3[] new Date[10];
    Date anObject = new Date();
    Arrays.fill(array3, "Help");
    anObject.setYear(102);
    for (int i=0, n=array3.length; i<n; i++) {
      System.out.println(array3[i]);
    }
  }
}


           
         
  
Related examples in the same category
1. illustrates how to use some of the methods of the Arrays class:
2. Sorting, Searching, and Inserting into a sorted arraySorting, Searching, and Inserting into a sorted array
3. Demonstrate use of Arrays.sort on Booleans
4. Convert an Array to a Vector
5. Convert Array to Collection
6. Convert array of object to array of primitive?
7. Compare if two array is equal
8. Array Search Test
9. Copy some items of an array into another array
10. Static methods from ArraysStatic methods from Arrays
11. Sort an arraySort an array
12. Sort an array: case-sensitive
13. Sort an array: case-insensitive
14. Java Sort byte Array
15. Java Sort char Array
16. Java Sort double Array
17. Java Sort float Array
18. Expanding an Array
19. Compare two byte type arrays
20. Compare two char type arrays
21. Compare two short type arrays
22. Compare two int type arrays
23. Compare two long type arrays
24. Compare two float type arrays
25. Compare two double type arrays
26. Filling Elements in an Array: boolean type
27. Filling Elements in an Array: byte type
28. Filling Elements in an Array: char type
29. Filling Elements in an Array: short type
30. Filling Elements in an Array: int type
31. Filling Elements in an Array: long type
32. Filling Elements in an Array: float type
33. Filling Elements in an Array: double type
34. filling object arrays:
35. fill to a contiguous range of elements in an array: boolean array
36. Fill to a contiguous range of elements in an array: byte array
37. Fill to a contiguous range of elements in an array: char array
38. Fill to a contiguous range of elements in an array: short array
39. Fill to a contiguous range of elements in an array: int array
40. Fill to a contiguous range of elements in an array: long array
41. Fill to a contiguous range of elements in an array: float array
42. Use Arrays.asList() to convert Array to List
43. Merge (or add) two arrays into one
44. Fill to a contiguous range of elements in an array: double array
45. Fill to a contiguous range of elements in an array: String array
46. Minimum and maximum number in array
47. Finding an Element in a Sorted Array
48. Shuffle elements of an array
49. Shifting Elements in an Array: Shift all elements right by one
50. Shifting Elements in an Array: Shift all elements left by one
51. Use java.util.Arrays.deepToString() to dump the multi-dimensional arrays
52. use Arrays.copyOf to copy array
53. If the element is a primitive type.
54. When comparing Object arrays, null elements are equal. If the elements are not null, Object.equals() is used.
55. Comparing Arrays: null arrays are equal
56. Compare two boolean arrays and null
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.