Skip to content

Instantly share code, notes, and snippets.

View Yordan-Petrov-work1's full-sized avatar

Yordan Petrov Yordan-Petrov-work1

  • Bulgaria
  • 05:27 (UTC +03:00)
View GitHub Profile
@Yordan-Petrov-work1
Yordan-Petrov-work1 / VIN.java
Created November 23, 2019 04:27 — forked from ubergesundheit/VIN.java
VIN validator/decoder
public class VIN {
//from http://introcs.cs.princeton.edu/java/31datatype/VIN.java.html
public static boolean isVinValid(String vin) {
int[] values = { 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 0, 7, 0, 9,
2, 3, 4, 5, 6, 7, 8, 9 };
int[] weights = { 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 };