Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:15:46+00:00 2026-06-08T09:15:46+00:00

I am developing a set of tools in Java for validating and working with

  • 0

I am developing a set of tools in Java for validating and working with credit cards. So far I have support for:

  • LUHN validation.

  • Date validation (simple expiration).

  • Card code length validation (CVV, CVC, CID) based on the brand (Visa, MasterCard, etc).

  • Credit card number length validation (based on the brand).

  • BIN/IIN validation (against a database of valid numbers).

  • Hiding the digits (425010 * * * * * * 1234)

To make the tool set a bit more complete, I would like to create a credit card random number generator based on the different card brands. This functionality will (hopefully) make my test cases a bit more reliable.

Basically, I would like to be able to generate numbers which are:

  • LUHN valid

  • Valid based on the brand prefixes

  • Valid based on the BIN/IIN prefix numbers

For BIN/IIN valid card numbers, I am thinking of looking up a random BIN/IIN number from the database (based on the brand of course) and then appending the remaining digits using Random. Obviously, that would not be valid most of the time and I will have to increment one of the digits until it passes the LUHN validation.

I can’t seem to be able to think of a better way. Perhaps someone could suggest something a little smarter…?

Looking forward to your suggestions! Thanks in advance! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:15:49+00:00Added an answer on June 8, 2026 at 9:15 am

    This functionality will (hopefully) make my test cases a bit more reliable.

    I’m not convinced. In my experience, it is not a good idea to use random data in unit tests, because you never know if you’ve covered all of the important cases … and bugs.

    I’d recommend creating your test credit card numbers by hand, and taking care that they cover all of the cases that need to be tested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening, I am developing a set of Java classes so that a container
I am developing a desktop app using Java and Swing Application Framework. I have
I am working on a job where we are developing a set of cross-platform
I'm developing a new set of web services at my company. My manager asked
I am developing an Android Service basically I set an alarm every 3 minutes
I'm developing my Android app with target set to 15, but would still like
I am developing a silverlight application where you can set sales target for specific
I am developing a website in which a cookie is set when the user
I've been developing a project on my local machine and had set up a
I am developing a Photoshop CS4 script and want to set some of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.