SAN FRANCISCO — U.S. District Judge William Alsup handed Google Inc. a major victory Thursday when he dismissed claims that the Android mobile phone platform infringes Oracle Corp.’s copyrights relating to the Java computer language.

Oracle had accused Google of infringing the “structure, sequence and organization” of 37 of Java’s API packages, or application programming interfaces. In a 41-page decision, Alsup ruled that the particular Java elements Google replicated were free for all to use under copyright law. “So long as the specific code used to implement a method is different, anyone is free under the Copyright Act to write his or her own code to carry out exactly the same function or specification of any methods used in the Java API,” Alsup wrote.