Java Array Length Get length(float[] color)

Here you can find the source of length(float[] color)

Description

Length of a vector.

License

Open Source License

Declaration

public static double length(float[] color) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 Christian Hensel/*from   ww  w .j av  a 2s . c  om*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Christian Hensel - initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * Length of a vector.
     */
    public static double length(float[] color) {
        return Math.sqrt(color[0] * color[0] + color[1] * color[1] + color[2] * color[2]);
    }
}

Related

  1. length(double[] v)
  2. length(double[] x)
  3. length(final double[] a)
  4. length(final Object[] array)
  5. length(final T[]... arrays)
  6. length(int[] tail)
  7. length(int[][] instance, int u)
  8. length(long[] v)
  9. length(Object anArray[])