The boilerplate notice for the Apache License is:
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You may
obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
There is also the complete Apache License v2 available in HTML and TXT formats.
If you are distributing a source code for a project, you should place the complete license in a text file called LICENSE at the root of the project. If you need a NOTICE file (projects run by the Apache Software Foundation require one), it goes at the same level.
If you are distributing a binary for a project and are providing a JAR or a tarball, then the LICENSE (and NOTICE) files must be at the top level. That is, when you uncompress the file, you should see a LICENSE (and NOTICE) file in the target.
If you are distribute a single file (such as a Gist on GitHub), then you are probably OK with putting the boilerplate notice at the top of the file.
If you are using Apache License v2 licensed software in your project, you need to include the LICENSE and NOTICE files for that library. The way I usually do this is that I have a
lib directory in the root of my project. I would extract the library distribution into a subdirectory of the lib directory. Assuming that the author packaged their application properly, it will contain the appropriate license files.