The first question, whether the defendant has a right to challenge the fornication statute as an unconstitutional invasion of privacy, is disposed of by the holding of this court in Jones v. State (1972), 55 Wis. 2d 742, 200 N. W. 2d 587. In that case, this court held that one convicted of sodomy under sec. 944.17 (1), Stats., could not raise the constitutional defense of overbreadth by alleging it would cover private consensual acts of married persons where the acts in question had been forced on another by the defendant. This court said, page 748:
“Certainly the state has a legitimate interest in prohibiting heinous acts like those perpetrated by the defendant in this case. His conduct was not . . . consensual ... ; on the contrary, it was . . . accomplished, not with a consenting spouse but forced upon a victim . . . who was unable to escape from the defendant’s physical violence and demands. There is no constitutional protection for the revolting conduct of the defendant . . . the hypothetical he raises [consensual acts by married persons] has no reasonable relation to his conduct or the purpose of the statute. It can hardly be said the defendant . . . has any real or concrete interest in the vindication of the rights of privacy of married couples and he should not be allowed to use a reference to such rights to escape a conviction for his criminal acts.”
*421This court pointed out, page 747:
“The test for overbreadth is whether the substantive limits of the statute sweep so broadly as to prohibit or discourage conduct protected by the constitution. The rights protected are usually found in the penumbras of the first and ninth amendments of the United States Constitution. . . .”
The defendant challenges the fornication statute as being an unconstitutional invasion of the right of privacy of individuals when intercourse occurs between consenting adults.
In the case at bar, the act of intercourse was not consensual by any stretch of the imagination. The victim testified repeatedly that the reason she submitted was because the defendant “told me he had a weapon and I did not want him to use it on me.” She testified she earlier screamed three or four times and was crying. She testified she was shocked and afraid when defendant forced his way into her car, and the record shows she tried unsuccessfully to escape. Counsel for the defendant says that since the court did not find the defendant guilty of rape, it follows that the intercourse had not occurred by force or against the victim’s will, implying thereby that she consented. The trial judge, after stating for the record what instruction he would have given a jury on what constituted rape, said: “I’m not satisfied from my analysis of the evidence presented that the State has under the law applicable met its burden of proof to the quantum required, and that is beyond a reasonable doubt, and it would be simply rhetorical to say I am morally convinced that the defendant committed the act [rape] . . .” The court found the defendant not guilty of rape but of the included offense of fornication. Statements the judge made at the time of sentencing, referred to below, show that the trial judge did not regard this as an act of sexual intercourse between consenting adults. *422Under defense counsel’s logic that what occurred was entirely consensual, the victim should also have been arrested for fornication. In view of the record, the absurdity of this position needs only to be stated to be obvious.
Since the trial court did not find the defendant guilty of rape, we are not called upon to comment on the sufficiency of the record, had such finding been made.
We conclude, therefore, that this defendant cannot challenge the fornication statute on constitutional grounds under any theory of consensual acts between adults, since the act here was clearly not consensual.
Counsel for the defendant directs our attention to Lovisi v. Slayton (D. C. Va. 1978), 363 Fed. Supp. 620. In that case, a challenge was made to the constitutionality of a Virginia statute proscribing acts of sodomy. Lovisi and his wife had engaged in such acts with a third person and claimed the statute proscribing acts of sodomy was unconstitutional as an invasion of the right of privacy. Mr. and Mrs. Lovisi had permitted pictures to be taken of themselves in the act and the pictures had fallen into the hands of Mrs. Lovisi’s children; the court held such acts thereby lost any character of being “private.” The court said, pages 623, 624:
“The Court is faced with the . . . question of whether, if the Lovisis’ conduct was not constitutionally protected, they may attack the constitutionality of [the statute] on the basis of the rights of third persons. . . . The Court . . . holds that they do not have standing to assert the constitutional rights of other persons and thus may not attack the constitutionality of statutes underlying their conviction on this basis.”
We agree with Lovisi and conclude that Byrd does not have standing to attack the constitutionality of the fornication statute.
The second question in this case is whether or not the trial court abused its discretion in the imposition of maxi*423mum sentences of incarceration of six months for the fornication and two years each for the counts of false imprisonment. It is clear that the trial judge believed the testimony of the two women complainants and did not believe the testimony of the defendant. The defense does not challenge the sufficiency of the evidence but does allege abuse of discretion in imposing maximum consecutive sentences of incarceration. It is clear that the judge regarded these offenses as serious. In sentencing the defendant, the judge said:
“In my view the defendant has demonstrated that he is a continuing threat to the welfare of the community and the security of those who are members thereof. I believe that he can be safely and accurately characterized as a beast of prey, and his activities in the space of approximately a week resulting in the charges here before the Court indicate that he is in need of that type of control and supervision which is available only under the most highly structured of circumstances. . . .
“Accordingly, by this defendant’s conduct this Court deems it appropriate in his own interests, for his future rehabilitation, and in the interests of the protection of the members of this community, that the following sentences be imposed.”
We are of the opinion that the characterization by the court of the acts of the defendant are supported by the record. The trial court felt the sentences were necessary to protect the community, which is a proper factor to be considered in the imposition of sentences. Bastian v. State (1972), 54 Wis. 2d 240, 245, 194 N. W. 2d 687; Moore v. State (1972), 55 Wis. 2d 1, 9, 197 N. W. 2d 820.
This court in Gaddis v. State (1974), 63 Wis. 2d 120, 129, 130, 216 N. W. 2d 527, said:
“This court will modify a sentence only where there has been a clear abuse of discretion, and an abuse of discretion will be found only where there is no rational basis for the sentence imposed, or where the rationale for the *424sentence imposed is not either articulated in or inferable from the record.”
Here, the court clearly articulated the rationale for the sentences imposed. There was certainly a rational basis for these sentences in view of the record. We find no abuse of discretion.
The third question is whether or not the defendant should receive credit toward his sentences for the period of his preconvietion incarceration. The defendant in his brief claims he was in jail for a period of eighty-two days from February 7, 1973, when he initially appeared, until May 1, 1973, when he was convicted and sentenced. The state raises the point that the record is not clear that he was actually incarcerated during this entire period. The issue was not raised before the trial court.
We hold that a defendant must be given credit for time spent in custody prior to conviction to the extent such time added to the sentence imposed exceeds the maximum sentence permitted under the statute for such offense, provided such time spent in custody was a result of the criminal charge for which a prison or jail sentence is imposed or as a result of the conduct on which such charge is based, provided further that such custody was the result of the defendant’s financial inability to post bail.
We agree with that part of the reasoning of the court in the case of Culp v. Bounds (D. C. N. C. 1971), 325 Fed. Supp. 416, 419, holding that where the statutory maximum sentence is given the failure to give credit for preconviction time spent in custody violates the Equal Protection Clause of the fourteenth amendment. The court said:
“North Carolina’s failure to give Culp credit for time served before trial where petitioner has received a maximum sentence violates the Constitution ....
*425“. . . the fact that only those accused who are unable to raise bail are subjected to extra pre-trial incarceration when their prison time exceeds the statutory maximum (as with Culp) is an invidious discrimination against the poor in violation of the equal protection clause of the Fourteenth Amendment. See, e. g., Griffin v. Illinois, 351 U. S. 12, 76 S. Ct. 585, 100 L. Ed. 891 (1956); Douglas v. California, 372 U. S. 353, 83 S. Ct. 814, 9 L. Ed. 2d 811 (1963); Tate v. Short, 401 U. S. 395, 91 S. Ct. 668, 28 L. Ed. 2d 130 (1971). . . .
“. . . Culp should be given credit for time spent in custody prior to commitment where he has been given a maximum sentence. Pre-trial detention is nothing less than punishment. An unconvicted accused who is not allowed or cannot raise bail is deprived of his liberty. . . . Fundamental notions of fair play . . . require that Culp receive credit for pre-commitment incarceration. . . .
“Alternatively, the state’s refusal to give Culp credit for pre-trial detention is an unconstitutional discrimination on the basis of wealth prohibited by the Fourteenth Amendment. As outlined above, wealthy defendants (except where no bail is allowed) are able to remain out of prison until conviction and sentencing; the poor stay behind bars.”
The United States Supreme Court has not dealt with this issue.4
The holdings in Cheney v. State (1969), 44 Wis. 2d 454, 171 N. W. 2d 339, 174 N. W. 2d 1, and State v. Tew (1972), 54 Wis. 2d 361, 195 N. W. 2d 615, that credit need not be given for preconviction incarceration where a maximum sentence is imposed are overruled.
We further hold that in imposing any sentence, the court must, in exercising its discretion, take into con*426sideration, in determining the length of sentence to be imposed, the time the defendant has spent in preconviction custody. Such consideration must be given even though the time spent in custody when added to the sentence would be less than the maximum. This requirement modifies Tew by making such consideration mandatory rather than permissive.
Because the record in this case is not clear as to the time actually spent in custody by the defendant prior to conviction and whether or not it was due to financial inability to post bail, we remand the cause to the trial court for appropriate findings and a reduction of the maximum sentence imposed accordingly if the facts come within the rule enunciated in this opinion.
By the Court. — Judgment of conviction affirmed; judgment of sentence reversed; and cause remanded for further proceedings not inconsistent with the opinion.